In [1]:
!pip install collinearity
Collecting collinearity
  Downloading collinearity-0.6.1.tar.gz (5.0 kB)
Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from collinearity) (1.19.5)
Requirement already satisfied: scikit-learn in /usr/local/lib/python3.7/dist-packages (from collinearity) (0.22.2.post1)
Requirement already satisfied: scipy>=0.17.0 in /usr/local/lib/python3.7/dist-packages (from scikit-learn->collinearity) (1.4.1)
Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.7/dist-packages (from scikit-learn->collinearity) (1.0.1)
Building wheels for collected packages: collinearity
  Building wheel for collinearity (setup.py) ... done
  Created wheel for collinearity: filename=collinearity-0.6.1-py3-none-any.whl size=4459 sha256=27ecc707173306fa011ce5d591b738daeaafb1c75b5094ff52e5199843d097ee
  Stored in directory: /root/.cache/pip/wheels/31/bf/74/0a475ad9095545c56fe02d678ccd38739baa81513e877d91ca
Successfully built collinearity
Installing collected packages: collinearity
Successfully installed collinearity-0.6.1
In [2]:
from collinearity import SelectNonCollinear
In [116]:
# Essentials
import numpy as np
import pandas as pd
import itertools
#import random

# Stats
from scipy import stats
from scipy.stats import skew, norm
from scipy.stats import boxcox_normmax
from scipy.special import boxcox1p

# Plots
import seaborn as sns
import matplotlib.pyplot as plt

# Preprocessing Libraries
from sklearn.pipeline import make_pipeline
from sklearn.model_selection import train_test_split,GridSearchCV,StratifiedShuffleSplit
from sklearn.feature_selection import RFE
from sklearn.feature_selection import SelectFromModel, mutual_info_classif, f_classif, SelectKBest
from sklearn.preprocessing import StandardScaler, RobustScaler, MinMaxScaler, Normalizer
from sklearn.decomposition import PCA

# Machine Learning Libraries
from sklearn.feature_selection import f_regression
import statsmodels.api as sm
import sklearn
from sklearn import svm
import xgboost as xgb
from sklearn import tree
from sklearn.svm import SVC
from sklearn.metrics import roc_curve
from imblearn.pipeline import Pipeline
from imblearn.over_sampling import SMOTE
from sklearn.ensemble import StackingClassifier
from sklearn.metrics import classification_report
from mlxtend.classifier import StackingCVClassifier
from sklearn.ensemble import RandomForestClassifier, ExtraTreesRegressor, ExtraTreesClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import cross_val_predict
from sklearn.model_selection import RandomizedSearchCV
from sklearn.model_selection import KFold, cross_validate
from sklearn.metrics import recall_score, f1_score, roc_auc_score, log_loss, auc
from imblearn.pipeline import make_pipeline as imbalanced_make_pipeline
from sklearn.metrics import precision_recall_curve, average_precision_score, plot_confusion_matrix
from sklearn.model_selection import RepeatedStratifiedKFold, StratifiedKFold
from sklearn.metrics import confusion_matrix, accuracy_score, precision_score
from sklearn.feature_selection import SelectFromModel, mutual_info_classif, f_classif, SelectKBest
from sklearn.naive_bayes import GaussianNB
from nltk.classify.scikitlearn import SklearnClassifier

# Mapper
from sklearn_pandas import DataFrameMapper
# Oversample
from imblearn.over_sampling import SMOTE

# Ignore useless warnings
import warnings
warnings.filterwarnings('ignore')
%matplotlib inline

import io
import os

# allow muliple output in one cell window
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"

# display more rows and columns
pd.set_option('display.max_colwidth', None)
pd.options.display.max_rows = 999
In [4]:
from google.colab import drive
from pathlib import Path
main_path = '/content/drive/MyDrive/machine_learning/'
# change working directory
#print(os.chdir(main_path))
# get current directory
print(os.getcwd())
os.listdir()
/content
Out[4]:
['.config', 'sample_data']
In [5]:
drive.mount("/content/drive", force_remount=True)
Mounted at /content/drive
In [6]:
df = pd.read_csv(main_path+'/data.csv')
In [7]:
df_bankrupt = df['Bankrupt?']
df_copy = df.copy()
df_bankrupt.head()
df_copy.head()
Out[7]:
0    1
1    1
2    1
3    1
4    1
Name: Bankrupt?, dtype: int64
Out[7]:
Bankrupt? ROA(C) before interest and depreciation before interest ROA(A) before interest and % after tax ROA(B) before interest and depreciation after tax Operating Gross Margin Realized Sales Gross Margin Operating Profit Rate Pre-tax net Interest Rate After-tax net Interest Rate Non-industry income and expenditure/revenue Continuous interest rate (after tax) Operating Expense Rate Research and development expense rate Cash flow rate Interest-bearing debt interest rate Tax rate (A) Net Value Per Share (B) Net Value Per Share (A) Net Value Per Share (C) Persistent EPS in the Last Four Seasons Cash Flow Per Share Revenue Per Share (Yuan ¥) Operating Profit Per Share (Yuan ¥) Per Share Net profit before tax (Yuan ¥) Realized Sales Gross Profit Growth Rate Operating Profit Growth Rate After-tax Net Profit Growth Rate Regular Net Profit Growth Rate Continuous Net Profit Growth Rate Total Asset Growth Rate Net Value Growth Rate Total Asset Return Growth Rate Ratio Cash Reinvestment % Current Ratio Quick Ratio Interest Expense Ratio Total debt/Total net worth Debt ratio % Net worth/Assets Long-term fund suitability ratio (A) ... Current Assets/Total Assets Cash/Total Assets Quick Assets/Current Liability Cash/Current Liability Current Liability to Assets Operating Funds to Liability Inventory/Working Capital Inventory/Current Liability Current Liabilities/Liability Working Capital/Equity Current Liabilities/Equity Long-term Liability to Current Assets Retained Earnings to Total Assets Total income/Total expense Total expense/Assets Current Asset Turnover Rate Quick Asset Turnover Rate Working capitcal Turnover Rate Cash Turnover Rate Cash Flow to Sales Fixed Assets to Assets Current Liability to Liability Current Liability to Equity Equity to Long-term Liability Cash Flow to Total Assets Cash Flow to Liability CFO to Assets Cash Flow to Equity Current Liability to Current Assets Liability-Assets Flag Net Income to Total Assets Total assets to GNP price No-credit Interval Gross Profit to Sales Net Income to Stockholder's Equity Liability to Equity Degree of Financial Leverage (DFL) Interest Coverage Ratio (Interest expense to EBIT) Net Income Flag Equity to Liability
0 1 0.370594 0.424389 0.405750 0.601457 0.601457 0.998969 0.796887 0.808809 0.302646 0.780985 1.256969e-04 0.0 0.458143 0.000725 0.0 0.147950 0.147950 0.147950 0.169141 0.311664 0.017560 0.095921 0.138736 0.022102 0.848195 0.688979 0.688979 0.217535 4.980000e+09 0.000327 0.263100 0.363725 0.002259 0.001208 0.629951 0.021266 0.207576 0.792424 0.005024 ... 0.190643 0.004094 0.001997 1.473360e-04 0.147308 0.334015 0.276920 0.001036 0.676269 0.721275 0.339077 0.025592 0.903225 0.002022 0.064856 7.010000e+08 6.550000e+09 0.593831 4.580000e+08 0.671568 0.424206 0.676269 0.339077 0.126549 0.637555 0.458609 0.520382 0.312905 0.118250 0 0.716845 0.009219 0.622879 0.601453 0.827890 0.290202 0.026601 0.564050 1 0.016469
1 1 0.464291 0.538214 0.516730 0.610235 0.610235 0.998946 0.797380 0.809301 0.303556 0.781506 2.897851e-04 0.0 0.461867 0.000647 0.0 0.182251 0.182251 0.182251 0.208944 0.318137 0.021144 0.093722 0.169918 0.022080 0.848088 0.689693 0.689702 0.217620 6.110000e+09 0.000443 0.264516 0.376709 0.006016 0.004039 0.635172 0.012502 0.171176 0.828824 0.005059 ... 0.182419 0.014948 0.004136 1.383910e-03 0.056963 0.341106 0.289642 0.005210 0.308589 0.731975 0.329740 0.023947 0.931065 0.002226 0.025516 1.065198e-04 7.700000e+09 0.593916 2.490000e+09 0.671570 0.468828 0.308589 0.329740 0.120916 0.641100 0.459001 0.567101 0.314163 0.047775 0 0.795297 0.008323 0.623652 0.610237 0.839969 0.283846 0.264577 0.570175 1 0.020794
2 1 0.426071 0.499019 0.472295 0.601450 0.601364 0.998857 0.796403 0.808388 0.302035 0.780284 2.361297e-04 25500000.0 0.458521 0.000790 0.0 0.177911 0.177911 0.193713 0.180581 0.307102 0.005944 0.092338 0.142803 0.022760 0.848094 0.689463 0.689470 0.217601 7.280000e+09 0.000396 0.264184 0.368913 0.011543 0.005348 0.629631 0.021248 0.207516 0.792484 0.005100 ... 0.602806 0.000991 0.006302 5.340000e+09 0.098162 0.336731 0.277456 0.013879 0.446027 0.742729 0.334777 0.003715 0.909903 0.002060 0.021387 1.791094e-03 1.022676e-03 0.594502 7.610000e+08 0.671571 0.276179 0.446027 0.334777 0.117922 0.642765 0.459254 0.538491 0.314515 0.025346 0 0.774670 0.040003 0.623841 0.601449 0.836774 0.290189 0.026555 0.563706 1 0.016474
3 1 0.399844 0.451265 0.457733 0.583541 0.583541 0.998700 0.796967 0.808966 0.303350 0.781241 1.078888e-04 0.0 0.465705 0.000449 0.0 0.154187 0.154187 0.154187 0.193722 0.321674 0.014368 0.077762 0.148603 0.022046 0.848005 0.689110 0.689110 0.217568 4.880000e+09 0.000382 0.263371 0.384077 0.004194 0.002896 0.630228 0.009572 0.151465 0.848535 0.005047 ... 0.225815 0.018851 0.002961 1.010646e-03 0.098715 0.348716 0.276580 0.003540 0.615848 0.729825 0.331509 0.022165 0.906902 0.001831 0.024161 8.140000e+09 6.050000e+09 0.593889 2.030000e+09 0.671519 0.559144 0.615848 0.331509 0.120760 0.579039 0.448518 0.604105 0.302382 0.067250 0 0.739555 0.003252 0.622929 0.583538 0.834697 0.281721 0.026697 0.564663 1 0.023982
4 1 0.465022 0.538432 0.522298 0.598783 0.598783 0.998973 0.797366 0.809304 0.303475 0.781550 7.890000e+09 0.0 0.462746 0.000686 0.0 0.167502 0.167502 0.167502 0.212537 0.319162 0.029690 0.096898 0.168412 0.022096 0.848258 0.689697 0.689697 0.217626 5.510000e+09 0.000439 0.265218 0.379690 0.006022 0.003727 0.636055 0.005150 0.106509 0.893491 0.005303 ... 0.358380 0.014161 0.004275 6.804636e-04 0.110195 0.344639 0.287913 0.004869 0.975007 0.732000 0.330726 0.000000 0.913850 0.002224 0.026385 6.680000e+09 5.050000e+09 0.593915 8.240000e+08 0.671563 0.309555 0.975007 0.330726 0.110933 0.622374 0.454411 0.578469 0.311567 0.047725 0 0.795016 0.003878 0.623521 0.598782 0.839973 0.278514 0.024752 0.575617 1 0.035490

5 rows × 96 columns

In [8]:
print(df.shape)
df.head()
(6819, 96)
Out[8]:
Bankrupt? ROA(C) before interest and depreciation before interest ROA(A) before interest and % after tax ROA(B) before interest and depreciation after tax Operating Gross Margin Realized Sales Gross Margin Operating Profit Rate Pre-tax net Interest Rate After-tax net Interest Rate Non-industry income and expenditure/revenue Continuous interest rate (after tax) Operating Expense Rate Research and development expense rate Cash flow rate Interest-bearing debt interest rate Tax rate (A) Net Value Per Share (B) Net Value Per Share (A) Net Value Per Share (C) Persistent EPS in the Last Four Seasons Cash Flow Per Share Revenue Per Share (Yuan ¥) Operating Profit Per Share (Yuan ¥) Per Share Net profit before tax (Yuan ¥) Realized Sales Gross Profit Growth Rate Operating Profit Growth Rate After-tax Net Profit Growth Rate Regular Net Profit Growth Rate Continuous Net Profit Growth Rate Total Asset Growth Rate Net Value Growth Rate Total Asset Return Growth Rate Ratio Cash Reinvestment % Current Ratio Quick Ratio Interest Expense Ratio Total debt/Total net worth Debt ratio % Net worth/Assets Long-term fund suitability ratio (A) ... Current Assets/Total Assets Cash/Total Assets Quick Assets/Current Liability Cash/Current Liability Current Liability to Assets Operating Funds to Liability Inventory/Working Capital Inventory/Current Liability Current Liabilities/Liability Working Capital/Equity Current Liabilities/Equity Long-term Liability to Current Assets Retained Earnings to Total Assets Total income/Total expense Total expense/Assets Current Asset Turnover Rate Quick Asset Turnover Rate Working capitcal Turnover Rate Cash Turnover Rate Cash Flow to Sales Fixed Assets to Assets Current Liability to Liability Current Liability to Equity Equity to Long-term Liability Cash Flow to Total Assets Cash Flow to Liability CFO to Assets Cash Flow to Equity Current Liability to Current Assets Liability-Assets Flag Net Income to Total Assets Total assets to GNP price No-credit Interval Gross Profit to Sales Net Income to Stockholder's Equity Liability to Equity Degree of Financial Leverage (DFL) Interest Coverage Ratio (Interest expense to EBIT) Net Income Flag Equity to Liability
0 1 0.370594 0.424389 0.405750 0.601457 0.601457 0.998969 0.796887 0.808809 0.302646 0.780985 1.256969e-04 0.0 0.458143 0.000725 0.0 0.147950 0.147950 0.147950 0.169141 0.311664 0.017560 0.095921 0.138736 0.022102 0.848195 0.688979 0.688979 0.217535 4.980000e+09 0.000327 0.263100 0.363725 0.002259 0.001208 0.629951 0.021266 0.207576 0.792424 0.005024 ... 0.190643 0.004094 0.001997 1.473360e-04 0.147308 0.334015 0.276920 0.001036 0.676269 0.721275 0.339077 0.025592 0.903225 0.002022 0.064856 7.010000e+08 6.550000e+09 0.593831 4.580000e+08 0.671568 0.424206 0.676269 0.339077 0.126549 0.637555 0.458609 0.520382 0.312905 0.118250 0 0.716845 0.009219 0.622879 0.601453 0.827890 0.290202 0.026601 0.564050 1 0.016469
1 1 0.464291 0.538214 0.516730 0.610235 0.610235 0.998946 0.797380 0.809301 0.303556 0.781506 2.897851e-04 0.0 0.461867 0.000647 0.0 0.182251 0.182251 0.182251 0.208944 0.318137 0.021144 0.093722 0.169918 0.022080 0.848088 0.689693 0.689702 0.217620 6.110000e+09 0.000443 0.264516 0.376709 0.006016 0.004039 0.635172 0.012502 0.171176 0.828824 0.005059 ... 0.182419 0.014948 0.004136 1.383910e-03 0.056963 0.341106 0.289642 0.005210 0.308589 0.731975 0.329740 0.023947 0.931065 0.002226 0.025516 1.065198e-04 7.700000e+09 0.593916 2.490000e+09 0.671570 0.468828 0.308589 0.329740 0.120916 0.641100 0.459001 0.567101 0.314163 0.047775 0 0.795297 0.008323 0.623652 0.610237 0.839969 0.283846 0.264577 0.570175 1 0.020794
2 1 0.426071 0.499019 0.472295 0.601450 0.601364 0.998857 0.796403 0.808388 0.302035 0.780284 2.361297e-04 25500000.0 0.458521 0.000790 0.0 0.177911 0.177911 0.193713 0.180581 0.307102 0.005944 0.092338 0.142803 0.022760 0.848094 0.689463 0.689470 0.217601 7.280000e+09 0.000396 0.264184 0.368913 0.011543 0.005348 0.629631 0.021248 0.207516 0.792484 0.005100 ... 0.602806 0.000991 0.006302 5.340000e+09 0.098162 0.336731 0.277456 0.013879 0.446027 0.742729 0.334777 0.003715 0.909903 0.002060 0.021387 1.791094e-03 1.022676e-03 0.594502 7.610000e+08 0.671571 0.276179 0.446027 0.334777 0.117922 0.642765 0.459254 0.538491 0.314515 0.025346 0 0.774670 0.040003 0.623841 0.601449 0.836774 0.290189 0.026555 0.563706 1 0.016474
3 1 0.399844 0.451265 0.457733 0.583541 0.583541 0.998700 0.796967 0.808966 0.303350 0.781241 1.078888e-04 0.0 0.465705 0.000449 0.0 0.154187 0.154187 0.154187 0.193722 0.321674 0.014368 0.077762 0.148603 0.022046 0.848005 0.689110 0.689110 0.217568 4.880000e+09 0.000382 0.263371 0.384077 0.004194 0.002896 0.630228 0.009572 0.151465 0.848535 0.005047 ... 0.225815 0.018851 0.002961 1.010646e-03 0.098715 0.348716 0.276580 0.003540 0.615848 0.729825 0.331509 0.022165 0.906902 0.001831 0.024161 8.140000e+09 6.050000e+09 0.593889 2.030000e+09 0.671519 0.559144 0.615848 0.331509 0.120760 0.579039 0.448518 0.604105 0.302382 0.067250 0 0.739555 0.003252 0.622929 0.583538 0.834697 0.281721 0.026697 0.564663 1 0.023982
4 1 0.465022 0.538432 0.522298 0.598783 0.598783 0.998973 0.797366 0.809304 0.303475 0.781550 7.890000e+09 0.0 0.462746 0.000686 0.0 0.167502 0.167502 0.167502 0.212537 0.319162 0.029690 0.096898 0.168412 0.022096 0.848258 0.689697 0.689697 0.217626 5.510000e+09 0.000439 0.265218 0.379690 0.006022 0.003727 0.636055 0.005150 0.106509 0.893491 0.005303 ... 0.358380 0.014161 0.004275 6.804636e-04 0.110195 0.344639 0.287913 0.004869 0.975007 0.732000 0.330726 0.000000 0.913850 0.002224 0.026385 6.680000e+09 5.050000e+09 0.593915 8.240000e+08 0.671563 0.309555 0.975007 0.330726 0.110933 0.622374 0.454411 0.578469 0.311567 0.047725 0 0.795016 0.003878 0.623521 0.598782 0.839973 0.278514 0.024752 0.575617 1 0.035490

5 rows × 96 columns

In [9]:
df.info() # no missing value?
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 6819 entries, 0 to 6818
Data columns (total 96 columns):
 #   Column                                                    Non-Null Count  Dtype  
---  ------                                                    --------------  -----  
 0   Bankrupt?                                                 6819 non-null   int64  
 1    ROA(C) before interest and depreciation before interest  6819 non-null   float64
 2    ROA(A) before interest and % after tax                   6819 non-null   float64
 3    ROA(B) before interest and depreciation after tax        6819 non-null   float64
 4    Operating Gross Margin                                   6819 non-null   float64
 5    Realized Sales Gross Margin                              6819 non-null   float64
 6    Operating Profit Rate                                    6819 non-null   float64
 7    Pre-tax net Interest Rate                                6819 non-null   float64
 8    After-tax net Interest Rate                              6819 non-null   float64
 9    Non-industry income and expenditure/revenue              6819 non-null   float64
 10   Continuous interest rate (after tax)                     6819 non-null   float64
 11   Operating Expense Rate                                   6819 non-null   float64
 12   Research and development expense rate                    6819 non-null   float64
 13   Cash flow rate                                           6819 non-null   float64
 14   Interest-bearing debt interest rate                      6819 non-null   float64
 15   Tax rate (A)                                             6819 non-null   float64
 16   Net Value Per Share (B)                                  6819 non-null   float64
 17   Net Value Per Share (A)                                  6819 non-null   float64
 18   Net Value Per Share (C)                                  6819 non-null   float64
 19   Persistent EPS in the Last Four Seasons                  6819 non-null   float64
 20   Cash Flow Per Share                                      6819 non-null   float64
 21   Revenue Per Share (Yuan ¥)                               6819 non-null   float64
 22   Operating Profit Per Share (Yuan ¥)                      6819 non-null   float64
 23   Per Share Net profit before tax (Yuan ¥)                 6819 non-null   float64
 24   Realized Sales Gross Profit Growth Rate                  6819 non-null   float64
 25   Operating Profit Growth Rate                             6819 non-null   float64
 26   After-tax Net Profit Growth Rate                         6819 non-null   float64
 27   Regular Net Profit Growth Rate                           6819 non-null   float64
 28   Continuous Net Profit Growth Rate                        6819 non-null   float64
 29   Total Asset Growth Rate                                  6819 non-null   float64
 30   Net Value Growth Rate                                    6819 non-null   float64
 31   Total Asset Return Growth Rate Ratio                     6819 non-null   float64
 32   Cash Reinvestment %                                      6819 non-null   float64
 33   Current Ratio                                            6819 non-null   float64
 34   Quick Ratio                                              6819 non-null   float64
 35   Interest Expense Ratio                                   6819 non-null   float64
 36   Total debt/Total net worth                               6819 non-null   float64
 37   Debt ratio %                                             6819 non-null   float64
 38   Net worth/Assets                                         6819 non-null   float64
 39   Long-term fund suitability ratio (A)                     6819 non-null   float64
 40   Borrowing dependency                                     6819 non-null   float64
 41   Contingent liabilities/Net worth                         6819 non-null   float64
 42   Operating profit/Paid-in capital                         6819 non-null   float64
 43   Net profit before tax/Paid-in capital                    6819 non-null   float64
 44   Inventory and accounts receivable/Net value              6819 non-null   float64
 45   Total Asset Turnover                                     6819 non-null   float64
 46   Accounts Receivable Turnover                             6819 non-null   float64
 47   Average Collection Days                                  6819 non-null   float64
 48   Inventory Turnover Rate (times)                          6819 non-null   float64
 49   Fixed Assets Turnover Frequency                          6819 non-null   float64
 50   Net Worth Turnover Rate (times)                          6819 non-null   float64
 51   Revenue per person                                       6819 non-null   float64
 52   Operating profit per person                              6819 non-null   float64
 53   Allocation rate per person                               6819 non-null   float64
 54   Working Capital to Total Assets                          6819 non-null   float64
 55   Quick Assets/Total Assets                                6819 non-null   float64
 56   Current Assets/Total Assets                              6819 non-null   float64
 57   Cash/Total Assets                                        6819 non-null   float64
 58   Quick Assets/Current Liability                           6819 non-null   float64
 59   Cash/Current Liability                                   6819 non-null   float64
 60   Current Liability to Assets                              6819 non-null   float64
 61   Operating Funds to Liability                             6819 non-null   float64
 62   Inventory/Working Capital                                6819 non-null   float64
 63   Inventory/Current Liability                              6819 non-null   float64
 64   Current Liabilities/Liability                            6819 non-null   float64
 65   Working Capital/Equity                                   6819 non-null   float64
 66   Current Liabilities/Equity                               6819 non-null   float64
 67   Long-term Liability to Current Assets                    6819 non-null   float64
 68   Retained Earnings to Total Assets                        6819 non-null   float64
 69   Total income/Total expense                               6819 non-null   float64
 70   Total expense/Assets                                     6819 non-null   float64
 71   Current Asset Turnover Rate                              6819 non-null   float64
 72   Quick Asset Turnover Rate                                6819 non-null   float64
 73   Working capitcal Turnover Rate                           6819 non-null   float64
 74   Cash Turnover Rate                                       6819 non-null   float64
 75   Cash Flow to Sales                                       6819 non-null   float64
 76   Fixed Assets to Assets                                   6819 non-null   float64
 77   Current Liability to Liability                           6819 non-null   float64
 78   Current Liability to Equity                              6819 non-null   float64
 79   Equity to Long-term Liability                            6819 non-null   float64
 80   Cash Flow to Total Assets                                6819 non-null   float64
 81   Cash Flow to Liability                                   6819 non-null   float64
 82   CFO to Assets                                            6819 non-null   float64
 83   Cash Flow to Equity                                      6819 non-null   float64
 84   Current Liability to Current Assets                      6819 non-null   float64
 85   Liability-Assets Flag                                    6819 non-null   int64  
 86   Net Income to Total Assets                               6819 non-null   float64
 87   Total assets to GNP price                                6819 non-null   float64
 88   No-credit Interval                                       6819 non-null   float64
 89   Gross Profit to Sales                                    6819 non-null   float64
 90   Net Income to Stockholder's Equity                       6819 non-null   float64
 91   Liability to Equity                                      6819 non-null   float64
 92   Degree of Financial Leverage (DFL)                       6819 non-null   float64
 93   Interest Coverage Ratio (Interest expense to EBIT)       6819 non-null   float64
 94   Net Income Flag                                          6819 non-null   int64  
 95   Equity to Liability                                      6819 non-null   float64
dtypes: float64(93), int64(3)
memory usage: 5.0 MB
In [10]:
df.describe()
Out[10]:
Bankrupt? ROA(C) before interest and depreciation before interest ROA(A) before interest and % after tax ROA(B) before interest and depreciation after tax Operating Gross Margin Realized Sales Gross Margin Operating Profit Rate Pre-tax net Interest Rate After-tax net Interest Rate Non-industry income and expenditure/revenue Continuous interest rate (after tax) Operating Expense Rate Research and development expense rate Cash flow rate Interest-bearing debt interest rate Tax rate (A) Net Value Per Share (B) Net Value Per Share (A) Net Value Per Share (C) Persistent EPS in the Last Four Seasons Cash Flow Per Share Revenue Per Share (Yuan ¥) Operating Profit Per Share (Yuan ¥) Per Share Net profit before tax (Yuan ¥) Realized Sales Gross Profit Growth Rate Operating Profit Growth Rate After-tax Net Profit Growth Rate Regular Net Profit Growth Rate Continuous Net Profit Growth Rate Total Asset Growth Rate Net Value Growth Rate Total Asset Return Growth Rate Ratio Cash Reinvestment % Current Ratio Quick Ratio Interest Expense Ratio Total debt/Total net worth Debt ratio % Net worth/Assets Long-term fund suitability ratio (A) ... Current Assets/Total Assets Cash/Total Assets Quick Assets/Current Liability Cash/Current Liability Current Liability to Assets Operating Funds to Liability Inventory/Working Capital Inventory/Current Liability Current Liabilities/Liability Working Capital/Equity Current Liabilities/Equity Long-term Liability to Current Assets Retained Earnings to Total Assets Total income/Total expense Total expense/Assets Current Asset Turnover Rate Quick Asset Turnover Rate Working capitcal Turnover Rate Cash Turnover Rate Cash Flow to Sales Fixed Assets to Assets Current Liability to Liability Current Liability to Equity Equity to Long-term Liability Cash Flow to Total Assets Cash Flow to Liability CFO to Assets Cash Flow to Equity Current Liability to Current Assets Liability-Assets Flag Net Income to Total Assets Total assets to GNP price No-credit Interval Gross Profit to Sales Net Income to Stockholder's Equity Liability to Equity Degree of Financial Leverage (DFL) Interest Coverage Ratio (Interest expense to EBIT) Net Income Flag Equity to Liability
count 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6.819000e+03 6.819000e+03 6819.000000 6.819000e+03 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6.819000e+03 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6.819000e+03 6.819000e+03 6819.000000 6819.000000 6.819000e+03 6.819000e+03 6819.000000 6.819000e+03 6819.000000 6819.000000 6819.000000 ... 6819.000000 6819.000000 6.819000e+03 6.819000e+03 6819.000000 6819.000000 6819.000000 6.819000e+03 6819.000000 6819.000000 6819.000000 6.819000e+03 6819.000000 6819.000000 6819.000000 6.819000e+03 6.819000e+03 6819.000000 6.819000e+03 6819.000000 6.819000e+03 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6.819000e+03 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.0 6819.000000
mean 0.032263 0.505180 0.558625 0.553589 0.607948 0.607929 0.998755 0.797190 0.809084 0.303623 0.781381 1.995347e+09 1.950427e+09 0.467431 1.644801e+07 0.115001 0.190661 0.190633 0.190672 0.228813 0.323482 1.328641e+06 0.109091 0.184361 0.022408 0.847980 0.689146 0.689150 0.217639 5.508097e+09 1.566212e+06 0.264248 0.379677 4.032850e+05 8.376595e+06 0.630991 4.416337e+06 0.113177 0.886823 0.008783 ... 0.522273 0.124095 3.592902e+06 3.715999e+07 0.090673 0.353828 0.277395 5.580680e+07 0.761599 0.735817 0.331410 5.416004e+07 0.934733 0.002549 0.029184 1.195856e+09 2.163735e+09 0.594006 2.471977e+09 0.671531 1.220121e+06 0.761599 0.331410 0.115645 0.649731 0.461849 0.593415 0.315582 0.031506 0.001173 0.807760 1.862942e+07 0.623915 0.607946 0.840402 0.280365 0.027541 0.565358 1.0 0.047578
std 0.176710 0.060686 0.065620 0.061595 0.016934 0.016916 0.013010 0.012869 0.013601 0.011163 0.012679 3.237684e+09 2.598292e+09 0.017036 1.082750e+08 0.138667 0.033390 0.033474 0.033480 0.033263 0.017611 5.170709e+07 0.027942 0.033180 0.012079 0.010752 0.013853 0.013910 0.010063 2.897718e+09 1.141594e+08 0.009634 0.020737 3.330216e+07 2.446847e+08 0.011238 1.684069e+08 0.053920 0.053920 0.028153 ... 0.218112 0.139251 1.716209e+08 5.103509e+08 0.050290 0.035147 0.010469 5.820516e+08 0.206677 0.011678 0.013488 5.702706e+08 0.025564 0.012093 0.027149 2.821161e+09 3.374944e+09 0.008959 2.938623e+09 0.009341 1.007542e+08 0.206677 0.013488 0.019529 0.047372 0.029943 0.058561 0.012961 0.030845 0.034234 0.040332 3.764501e+08 0.012290 0.016934 0.014523 0.014463 0.015668 0.013214 0.0 0.050014
min 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000e+00 0.000000e+00 0.000000 0.000000 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 0.000000 0.000000 0.000000 ... 0.000000 0.000000 0.000000e+00 0.000000e+00 0.000000 0.000000 0.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 0.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.0 0.000000
25% 0.000000 0.476527 0.535543 0.527277 0.600445 0.600434 0.998969 0.797386 0.809312 0.303466 0.781567 1.566874e-04 1.281880e-04 0.461558 2.030203e-04 0.000000 0.173613 0.173613 0.173676 0.214711 0.317748 1.563138e-02 0.096083 0.170370 0.022065 0.847984 0.689270 0.689270 0.217580 4.860000e+09 4.409689e-04 0.263759 0.374749 7.555047e-03 4.725903e-03 0.630612 3.007049e-03 0.072891 0.851196 0.005244 ... 0.352845 0.033543 5.239776e-03 1.973008e-03 0.053301 0.341023 0.277034 3.163148e-03 0.626981 0.733612 0.328096 0.000000e+00 0.931097 0.002236 0.014567 1.456236e-04 1.417149e-04 0.593934 2.735337e-04 0.671565 8.536037e-02 0.626981 0.328096 0.110933 0.633265 0.457116 0.565987 0.312995 0.018034 0.000000 0.796750 9.036205e-04 0.623636 0.600443 0.840115 0.276944 0.026791 0.565158 1.0 0.024477
50% 0.000000 0.502706 0.559802 0.552278 0.605997 0.605976 0.999022 0.797464 0.809375 0.303525 0.781635 2.777589e-04 5.090000e+08 0.465080 3.210321e-04 0.073489 0.184400 0.184400 0.184400 0.224544 0.322487 2.737571e-02 0.104226 0.179709 0.022102 0.848044 0.689439 0.689439 0.217598 6.400000e+09 4.619555e-04 0.264050 0.380425 1.058717e-02 7.412472e-03 0.630698 5.546284e-03 0.111407 0.888593 0.005665 ... 0.514830 0.074887 7.908898e-03 4.903886e-03 0.082705 0.348597 0.277178 6.497335e-03 0.806881 0.736013 0.329685 1.974619e-03 0.937672 0.002336 0.022674 1.987816e-04 2.247728e-04 0.593963 1.080000e+09 0.671574 1.968810e-01 0.806881 0.329685 0.112340 0.645366 0.459750 0.593266 0.314953 0.027597 0.000000 0.810619 2.085213e-03 0.623879 0.605998 0.841179 0.278778 0.026808 0.565252 1.0 0.033798
75% 0.000000 0.535563 0.589157 0.584105 0.613914 0.613842 0.999095 0.797579 0.809469 0.303585 0.781735 4.145000e+09 3.450000e+09 0.471004 5.325533e-04 0.205841 0.199570 0.199570 0.199612 0.238820 0.328623 4.635722e-02 0.116155 0.193493 0.022153 0.848123 0.689647 0.689647 0.217622 7.390000e+09 4.993621e-04 0.264388 0.386731 1.626953e-02 1.224911e-02 0.631125 9.273293e-03 0.148804 0.927109 0.006847 ... 0.689051 0.161073 1.295091e-02 1.280557e-02 0.119523 0.360915 0.277429 1.114677e-02 0.942027 0.738560 0.332322 9.005946e-03 0.944811 0.002492 0.035930 4.525945e-04 4.900000e+09 0.594002 4.510000e+09 0.671587 3.722000e-01 0.942027 0.332322 0.117106 0.663062 0.464236 0.624769 0.317707 0.038375 0.000000 0.826455 5.269777e-03 0.624168 0.613913 0.842357 0.281449 0.026913 0.565725 1.0 0.052838
max 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 9.990000e+09 9.980000e+09 1.000000 9.900000e+08 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 3.020000e+09 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 9.990000e+09 9.330000e+09 1.000000 1.000000 2.750000e+09 9.230000e+09 1.000000 9.940000e+09 1.000000 1.000000 1.000000 ... 1.000000 1.000000 8.820000e+09 9.650000e+09 1.000000 1.000000 1.000000 9.910000e+09 1.000000 1.000000 1.000000 9.540000e+09 1.000000 1.000000 1.000000 1.000000e+10 1.000000e+10 1.000000 1.000000e+10 1.000000 8.320000e+09 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 9.820000e+09 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.0 1.000000

8 rows × 96 columns

In [11]:
data_percent_missing = df.isnull().sum() * 100 / len(df)
data_missing_value = pd.DataFrame({'column_name': df.columns,'percent_missing': data_percent_missing})
data_missing_value = data_missing_value.sort_values('percent_missing',ascending=False)
data_missing_value['dtypes'] = df.dtypes
data_missing_value = data_missing_value[data_missing_value.percent_missing>0]
print(data_missing_value)
Empty DataFrame
Columns: [column_name, percent_missing, dtypes]
Index: []
In [12]:
print(df['Bankrupt?'].value_counts())
sns.countplot(x='Bankrupt?', data=df);
0    6599
1     220
Name: Bankrupt?, dtype: int64

Figure 1: Countplot of target variable

In [13]:
df.corr()['Bankrupt?'].sort_values(ascending=False)
Out[13]:
Bankrupt?                                                   1.000000
 Debt ratio %                                               0.250161
 Current Liability to Assets                                0.194494
 Borrowing dependency                                       0.176543
 Current Liability to Current Assets                        0.171306
 Liability to Equity                                        0.166812
 Current Liabilities/Equity                                 0.153828
 Current Liability to Equity                                0.153828
 Liability-Assets Flag                                      0.139212
 Total expense/Assets                                       0.139049
 Equity to Long-term Liability                              0.139014
 Cash/Current Liability                                     0.077921
 Inventory and accounts receivable/Net value                0.075278
 Fixed Assets Turnover Frequency                            0.072818
 Contingent liabilities/Net worth                           0.070455
 Fixed Assets to Assets                                     0.066328
 Net Value Growth Rate                                      0.065329
 Revenue per person                                         0.039718
 Total assets to GNP price                                  0.035104
 Quick Asset Turnover Rate                                  0.025814
 Quick Ratio                                                0.025058
 Net Worth Turnover Rate (times)                            0.021089
 Long-term fund suitability ratio (A)                       0.016920
 Total debt/Total net worth                                 0.012314
 Current Asset Turnover Rate                                0.011929
 Degree of Financial Leverage (DFL)                         0.010508
 Allocation rate per person                                 0.002829
 Inventory/Current Liability                                0.000822
 Long-term Liability to Current Assets                      0.000778
 Cash Flow to Sales                                         0.000479
 Operating Profit Rate                                     -0.000230
 Realized Sales Gross Profit Growth Rate                   -0.000458
 Inventory Turnover Rate (times)                           -0.001376
 Inventory/Working Capital                                 -0.001906
 Current Ratio                                             -0.002211
 Interest Expense Ratio                                    -0.002681
 Working capitcal Turnover Rate                            -0.002894
 Quick Assets/Current Liability                            -0.003823
 Revenue Per Share (Yuan ¥)                                -0.004692
 Accounts Receivable Turnover                              -0.004754
 Interest Coverage Ratio (Interest expense to EBIT)        -0.005509
 No-credit Interval                                        -0.005547
 Operating Expense Rate                                    -0.006083
 Average Collection Days                                   -0.006556
 Total income/Total expense                                -0.007137
 Continuous interest rate (after tax)                      -0.008395
 Pre-tax net Interest Rate                                 -0.008517
 After-tax net Interest Rate                               -0.008857
 Continuous Net Profit Growth Rate                         -0.009401
 Operating Profit Growth Rate                              -0.015168
 Non-industry income and expenditure/revenue               -0.016593
 Total Asset Return Growth Rate Ratio                      -0.016858
 Cash Turnover Rate                                        -0.018035
 Current Liability to Liability                            -0.020809
 Current Liabilities/Liability                             -0.020809
 Interest-bearing debt interest rate                       -0.023063
 Research and development expense rate                     -0.024232
 Regular Net Profit Growth Rate                            -0.036820
 After-tax Net Profit Growth Rate                          -0.037783
 Cash Flow to Liability                                    -0.043125
 Total Asset Growth Rate                                   -0.044431
 Current Assets/Total Assets                               -0.044823
 Cash Reinvestment %                                       -0.051345
 Cash Flow to Equity                                       -0.058563
 Total Asset Turnover                                      -0.067915
 Cash Flow to Total Assets                                 -0.070456
 Cash flow rate                                            -0.072356
 Operating Funds to Liability                              -0.077082
 Cash Flow Per Share                                       -0.077516
 Equity to Liability                                       -0.083048
 Quick Assets/Total Assets                                 -0.086382
 Operating profit per person                               -0.092842
 Realized Sales Gross Margin                               -0.099445
 Operating Gross Margin                                    -0.100043
 Gross Profit to Sales                                     -0.100044
 Cash/Total Assets                                         -0.100130
 Tax rate (A)                                              -0.109706
 CFO to Assets                                             -0.115383
 Operating profit/Paid-in capital                          -0.141111
 Operating Profit Per Share (Yuan ¥)                       -0.142051
 Working Capital/Equity                                    -0.147221
 Net Value Per Share (C)                                   -0.164784
 Net Value Per Share (B)                                   -0.165399
 Net Value Per Share (A)                                   -0.165465
 Net Income to Stockholder's Equity                        -0.180987
 Working Capital to Total Assets                           -0.193083
 Per Share Net profit before tax (Yuan ¥)                  -0.201395
 Net profit before tax/Paid-in capital                     -0.207857
 Retained Earnings to Total Assets                         -0.217779
 Persistent EPS in the Last Four Seasons                   -0.219560
 Net worth/Assets                                          -0.250161
 ROA(C) before interest and depreciation before interest   -0.260807
 ROA(B) before interest and depreciation after tax         -0.273051
 ROA(A) before interest and % after tax                    -0.282941
 Net Income to Total Assets                                -0.315457
 Net Income Flag                                                 NaN
Name: Bankrupt?, dtype: float64

Figure 2: Correlation with target variable

In [14]:
# check collinearity
df_train_num =  df.select_dtypes(include=np.number)
print("Numerical:", df_train_num.shape)
plt.subplots(figsize=(38, 38))
sns.heatmap(df_train_num.corr(), annot =False, vmin=-1, vmax=1, center= 0, cmap= 'coolwarm', fmt='.1g')
Numerical: (6819, 96)
Out[14]:
(<Figure size 2736x2736 with 1 Axes>,
 <matplotlib.axes._subplots.AxesSubplot at 0x7fb9aa8dadd0>)
Out[14]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9aa8dadd0>

Figure 3: Heatmap correlation matrix for collinearity

In [15]:
fig, axs = plt.subplots(ncols=2, nrows=0, figsize=(12, 200))
plt.subplots_adjust(right=2)
plt.subplots_adjust(top=2)
for i, col in enumerate(list(df), 1):
  plt.subplot(len(list(df)), 3, i)
  sns.set_style("white")
  x1 = df.loc[df['Bankrupt?']==1,[col]]
  x2 = df.loc[df['Bankrupt?']==0,[col]]
  # Plot
  #kwargs = dict(hist_kws={'alpha':.6}, kde_kws={'linewidth':2})
  #plt.figure(figsize=(10,7), dpi= 80)
  sns.distplot(x1, color="dodgerblue", label="Bankrupt")
  sns.distplot(x2, color="orange", label="Not Bankrupt")
  plt.ylim(0,None) 
  plt.xlabel('{}'.format(col), size=15,labelpad=12.5)
  plt.ylabel('Bankrupt?', size=15, labelpad=12.5)

  for j in range(2):
      plt.tick_params(axis='x', labelsize=12)
      plt.tick_params(axis='y', labelsize=12)
#plt.xlabel(col)
  plt.legend(loc='best', prop={'size': 10})
        
plt.show()
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9a1669ad0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9a1669ad0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9a1669ad0>
Out[15]:
(0.0, 52.49999999999996)
Out[15]:
Text(0.5, 0, 'Bankrupt?')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99fe4c2d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99fd86490>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99fd86490>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99fd86490>
Out[15]:
(0.0, 10.286785876647969)
Out[15]:
Text(0.5, 0, ' ROA(C) before interest and depreciation before interest')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99fc34f90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9aa623dd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9aa623dd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9aa623dd0>
Out[15]:
(0.0, 11.44001426190167)
Out[15]:
Text(0.5, 0, ' ROA(A) before interest and % after tax')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb9a16cbe50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9a1730410>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9a1730410>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9a1730410>
Out[15]:
(0.0, 11.217608728595232)
Out[15]:
Text(0.5, 0, ' ROA(B) before interest and depreciation after tax')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb9a1730210>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99fae5390>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99fae5390>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99fae5390>
Out[15]:
(0.0, 60.63143720584567)
Out[15]:
Text(0.5, 0, ' Operating Gross Margin')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99f9555d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f9c5090>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f9c5090>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f9c5090>
Out[15]:
(0.0, 59.11565127569953)
Out[15]:
Text(0.5, 0, ' Realized Sales Gross Margin')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99f846f10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99fa3b4d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99fa3b4d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99fa3b4d0>
Out[15]:
(0.0, 2559.356676183361)
Out[15]:
Text(0.5, 0, ' Operating Profit Rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99f5dd5d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f5ddbd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f5ddbd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f5ddbd0>
Out[15]:
(0.0, 888.7409516868166)
Out[15]:
Text(0.5, 0, ' Pre-tax net Interest Rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99f5a21d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f46a990>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f46a990>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f46a990>
Out[15]:
(0.0, 822.867087060867)
Out[15]:
Text(0.5, 0, ' After-tax net Interest Rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99f47f290>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f364050>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f364050>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f364050>
Out[15]:
(0.0, 627.9337458090101)
Out[15]:
Text(0.5, 0, ' Non-industry income and expenditure/revenue')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99f2ec5d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f3b8c50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f3b8c50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f3b8c50>
Out[15]:
(0.0, 982.4080182746294)
Out[15]:
Text(0.5, 0, ' Continuous interest rate (after tax)')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99f06d0d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f0d4290>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f0d4290>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f0d4290>
Out[15]:
(0.0, 1e-12)
Out[15]:
Text(0.5, 0, ' Operating Expense Rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99fd3a490>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f146450>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f146450>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f146450>
Out[15]:
(0.0, 1e-12)
Out[15]:
Text(0.5, 0, ' Research and development expense rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99eeba650>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99eec1110>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99eec1110>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99eec1110>
Out[15]:
(0.0, 120.9648944805199)
Out[15]:
Text(0.5, 0, ' Cash flow rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99ed5b090>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99ee4b810>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99ee4b810>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99ee4b810>
Out[15]:
(0.0, 1.2098308668076108e-07)
Out[15]:
Text(0.5, 0, ' Interest-bearing debt interest rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99eb8afd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99eb8ab90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99eb8ab90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99eb8ab90>
Out[15]:
(0.0, 19.29365055311411)
Out[15]:
Text(0.5, 0, ' Tax rate (A)')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99eaefe90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99ed0bf10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99ed0bf10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99ed0bf10>
Out[15]:
(0.0, 23.638872763266193)
Out[15]:
Text(0.5, 0, ' Net Value Per Share (B)')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99e997090>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99ea92690>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99ea92690>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99ea92690>
Out[15]:
(0.0, 23.638872763266193)
Out[15]:
Text(0.5, 0, ' Net Value Per Share (A)')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99e8b9250>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e7dea10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e7dea10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e7dea10>
Out[15]:
(0.0, 27.77087084790204)
Out[15]:
Text(0.5, 0, ' Net Value Per Share (C)')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99e7a29d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e6e3cd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e6e3cd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e6e3cd0>
Out[15]:
(0.0, 24.10331547401718)
Out[15]:
Text(0.5, 0, ' Persistent EPS in the Last Four Seasons')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99e6e3d10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e5a0ad0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e5a0ad0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e5a0ad0>
Out[15]:
(0.0, 72.49354988564909)
Out[15]:
Text(0.5, 0, ' Cash Flow Per Share')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99e582890>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e44ba10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e44ba10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e44ba10>
Out[15]:
(0.0, 31.800695619504125)
Out[15]:
Text(0.5, 0, ' Revenue Per Share (Yuan ¥)')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99eca4ed0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e86cad0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e86cad0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e86cad0>
Out[15]:
(0.0, 40.367876141325716)
Out[15]:
Text(0.5, 0, ' Operating Profit Per Share (Yuan ¥)')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99e23a050>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e170910>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e170910>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e170910>
Out[15]:
(0.0, 25.28453704754437)
Out[15]:
Text(0.5, 0, ' Per Share Net profit before tax (Yuan ¥)')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99e08ca50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e08c650>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e08c650>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99e08c650>
Out[15]:
(0.0, 794.6507675208318)
Out[15]:
Text(0.5, 0, ' Realized Sales Gross Profit Growth Rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99e23a250>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99de9de90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99de9de90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99de9de90>
Out[15]:
(0.0, 430.43466662109705)
Out[15]:
Text(0.5, 0, ' Operating Profit Growth Rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99df8ef50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99de5a450>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99de5a450>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99de5a450>
Out[15]:
(0.0, 235.88384508891284)
Out[15]:
Text(0.5, 0, ' After-tax Net Profit Growth Rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99de11d50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99dba33d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99dba33d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99dba33d0>
Out[15]:
(0.0, 166.00080774078765)
Out[15]:
Text(0.5, 0, ' Regular Net Profit Growth Rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99de5a610>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99da2e490>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99da2e490>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99da2e490>
Out[15]:
(0.0, 866.754410591733)
Out[15]:
Text(0.5, 0, ' Continuous Net Profit Growth Rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99d9937d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d8b4350>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d8b4350>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d8b4350>
Out[15]:
(0.0, 1e-12)
Out[15]:
Text(0.5, 0, ' Total Asset Growth Rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99d843090>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d8b46d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d8b46d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d8b46d0>
Out[15]:
(0.0, 1.2224976398628745e-07)
Out[15]:
Text(0.5, 0, ' Net Value Growth Rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99d69f7d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d639690>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d639690>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d639690>
Out[15]:
(0.0, 650.3368716576879)
Out[15]:
Text(0.5, 0, ' Total Asset Return Growth Rate Ratio')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99df3af10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99df15990>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99df15990>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99df15990>
Out[15]:
(0.0, 44.12466983639061)
Out[15]:
Text(0.5, 0, ' Cash Reinvestment %')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99d8fa550>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d40fcd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d40fcd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d40fcd0>
Out[15]:
(0.0, 133.25758895690984)
Out[15]:
Text(0.5, 0, ' Current Ratio')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99d282150>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d2e44d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d2e44d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d2e44d0>
Out[15]:
(0.0, 1e-12)
Out[15]:
Text(0.5, 0, ' Quick Ratio')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99d100410>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d26a7d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d26a7d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d26a7d0>
Out[15]:
(0.0, 160.83422904699677)
Out[15]:
Text(0.5, 0, ' Interest Expense Ratio')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99cf15c90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d022cd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d022cd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99d022cd0>
Out[15]:
(0.0, 1.5060911710770022e-08)
Out[15]:
Text(0.5, 0, ' Total debt/Total net worth')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99ce08150>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cda1c90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cda1c90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cda1c90>
Out[15]:
(0.0, 12.142953641238549)
Out[15]:
Text(0.5, 0, ' Debt ratio %')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99cd09050>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cc005d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cc005d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cc005d0>
Out[15]:
(0.0, 12.142953641238492)
Out[15]:
Text(0.5, 0, ' Net worth/Assets')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99cb19310>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cabc9d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cabc9d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cabc9d0>
Out[15]:
(0.0, 81.08501254188234)
Out[15]:
Text(0.5, 0, ' Long-term fund suitability ratio (A)')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99c9a9090>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cce4cd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cce4cd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cce4cd0>
Out[15]:
(0.0, 118.24461454163)
Out[15]:
Text(0.5, 0, ' Borrowing dependency')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99ca0dc50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cbc4690>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cbc4690>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cbc4690>
Out[15]:
(0.0, 973.5123127859379)
Out[15]:
Text(0.5, 0, ' Contingent liabilities/Net worth')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99c6a2410>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c64b110>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c64b110>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c64b110>
Out[15]:
(0.0, 37.73641762604199)
Out[15]:
Text(0.5, 0, ' Operating profit/Paid-in capital')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99cabc610>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c4fbb90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c4fbb90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c4fbb90>
Out[15]:
(0.0, 26.43313584988755)
Out[15]:
Text(0.5, 0, ' Net profit before tax/Paid-in capital')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99c3be410>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c779e10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c779e10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c779e10>
Out[15]:
(0.0, 84.53881493903849)
Out[15]:
Text(0.5, 0, ' Inventory and accounts receivable/Net value')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99c470f10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cb02490>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cb02490>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cb02490>
Out[15]:
(0.0, 8.91354545454546)
Out[15]:
Text(0.5, 0, ' Total Asset Turnover')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99c14af90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cd2fd10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cd2fd10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cd2fd10>
Out[15]:
(0.0, 4.283718330850049e-08)
Out[15]:
Text(0.5, 0, ' Accounts Receivable Turnover')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99c09e250>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c1d7810>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c1d7810>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c1d7810>
Out[15]:
(0.0, 3.8146980756497863e-07)
Out[15]:
Text(0.5, 0, ' Average Collection Days')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99c19fb10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bf613d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bf613d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bf613d0>
Out[15]:
(0.0, 1e-12)
Out[15]:
Text(0.5, 0, ' Inventory Turnover Rate (times)')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99bdec1d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bdecc90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bdecc90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bdecc90>
Out[15]:
(0.0, 1e-12)
Out[15]:
Text(0.5, 0, ' Fixed Assets Turnover Frequency')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99bcef610>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bc35710>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bc35710>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bc35710>
Out[15]:
(0.0, 30.18272727272723)
Out[15]:
Text(0.5, 0, ' Net Worth Turnover Rate (times)')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99bb8ca90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bc359d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bc359d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bc359d0>
Out[15]:
(0.0, 1.8732937708408395e-08)
Out[15]:
Text(0.5, 0, ' Revenue per person')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99b9b6390>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bab73d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bab73d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bab73d0>
Out[15]:
(0.0, 52.57156194378182)
Out[15]:
Text(0.5, 0, ' Operating profit per person')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99bbf8d90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bac1f90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bac1f90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99bac1f90>
Out[15]:
(0.0, 1.5017633228840127e-08)
Out[15]:
Text(0.5, 0, ' Allocation rate per person')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99b902a50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99ba7b050>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99ba7b050>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99ba7b050>
Out[15]:
(0.0, 7.576264891690021)
Out[15]:
Text(0.5, 0, ' Working Capital to Total Assets')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99b763650>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b5ad290>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b5ad290>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b5ad290>
Out[15]:
(0.0, 2.184762674131061)
Out[15]:
Text(0.5, 0, ' Quick Assets/Total Assets')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99b45d3d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b5518d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b5518d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b5518d0>
Out[15]:
(0.0, 1.8088195181088054)
Out[15]:
Text(0.5, 0, ' Current Assets/Total Assets')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99b3fb110>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b38ef10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b38ef10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b38ef10>
Out[15]:
(0.0, 25.63325908642265)
Out[15]:
Text(0.5, 0, ' Cash/Total Assets')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99b295990>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b2b86d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b2b86d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b2b86d0>
Out[15]:
(0.0, 157.19713106376622)
Out[15]:
Text(0.5, 0, ' Quick Assets/Current Liability')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99b350110>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b1f4410>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b1f4410>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b1f4410>
Out[15]:
(0.0, 1e-12)
Out[15]:
Text(0.5, 0, ' Cash/Current Liability')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99b0766d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b295bd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b295bd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b295bd0>
Out[15]:
(0.0, 9.466017122995527)
Out[15]:
Text(0.5, 0, ' Current Liability to Assets')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99ae96210>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99af529d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99af529d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99af529d0>
Out[15]:
(0.0, 43.49674116980162)
Out[15]:
Text(0.5, 0, ' Operating Funds to Liability')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99d08b090>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c974050>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c974050>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c974050>
Out[15]:
(0.0, 343.617405574133)
Out[15]:
Text(0.5, 0, ' Inventory/Working Capital')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99aeffb90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b8126d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b8126d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b8126d0>
Out[15]:
(0.0, 1e-12)
Out[15]:
Text(0.5, 0, ' Inventory/Current Liability')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99aa2b110>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b286e50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b286e50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99b286e50>
Out[15]:
(0.0, 5.938172450371269)
Out[15]:
Text(0.5, 0, ' Current Liabilities/Liability')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99abadd10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a964250>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a964250>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a964250>
Out[15]:
(0.0, 108.80607593957842)
Out[15]:
Text(0.5, 0, ' Working Capital/Equity')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99a941d50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a879c50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a879c50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a879c50>
Out[15]:
(0.0, 160.34732355173645)
Out[15]:
Text(0.5, 0, ' Current Liabilities/Equity')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99a7a8090>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a72e410>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a72e410>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a72e410>
Out[15]:
(0.0, 1e-12)
Out[15]:
Text(0.5, 0, ' Long-term Liability to Current Assets')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99a507650>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a4309d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a4309d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a4309d0>
Out[15]:
(0.0, 37.14091245209042)
Out[15]:
Text(0.5, 0, ' Retained Earnings to Total Assets')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99a5baed0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a43cc50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a43cc50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a43cc50>
Out[15]:
(0.0, 4046.828392528158)
Out[15]:
Text(0.5, 0, ' Total income/Total expense')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99a27eed0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a1a9190>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a1a9190>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a1a9190>
Out[15]:
(0.0, 31.1099394279351)
Out[15]:
Text(0.5, 0, ' Total expense/Assets')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99a1a9c50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a0e5050>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a0e5050>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a0e5050>
Out[15]:
(0.0, 1e-12)
Out[15]:
Text(0.5, 0, ' Current Asset Turnover Rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99a1796d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999f13e90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999f13e90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999f13e90>
Out[15]:
(0.0, 1e-12)
Out[15]:
Text(0.5, 0, ' Quick Asset Turnover Rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99a08d290>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a046410>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a046410>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a046410>
Out[15]:
(0.0, 1352.0234365728438)
Out[15]:
Text(0.5, 0, ' Working capitcal Turnover Rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb999e750d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999ccb590>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999ccb590>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999ccb590>
Out[15]:
(0.0, 1e-12)
Out[15]:
Text(0.5, 0, ' Cash Turnover Rate')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb999c45050>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999ccb6d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999ccb6d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999ccb6d0>
Out[15]:
(0.0, 38883.512991169184)
Out[15]:
Text(0.5, 0, ' Cash Flow to Sales')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb999c04bd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999c11990>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999c11990>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999c11990>
Out[15]:
(0.0, 3.217589485743754)
Out[15]:
Text(0.5, 0, ' Fixed Assets to Assets')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb999a4df10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9998e15d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9998e15d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9998e15d0>
Out[15]:
(0.0, 5.938172450371269)
Out[15]:
Text(0.5, 0, ' Current Liability to Liability')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb9998a3b10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999839b90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999839b90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999839b90>
Out[15]:
(0.0, 160.34732355173645)
Out[15]:
Text(0.5, 0, ' Current Liability to Equity')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb999734210>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999785f10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999785f10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999785f10>
Out[15]:
(0.0, 97.70098617251905)
Out[15]:
Text(0.5, 0, ' Equity to Long-term Liability')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb999687450>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9995469d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9995469d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9995469d0>
Out[15]:
(0.0, 36.833285761806124)
Out[15]:
Text(0.5, 0, ' Cash Flow to Total Assets')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99f0387d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999415350>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999415350>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999415350>
Out[15]:
(0.0, 100.3918192477624)
Out[15]:
Text(0.5, 0, ' Cash Flow to Liability')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb999240a10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999240290>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999240290>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb999240290>
Out[15]:
(0.0, 10.812397794766909)
Out[15]:
Text(0.5, 0, ' CFO to Assets')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99c1ca050>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c13f1d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c13f1d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99c13f1d0>
Out[15]:
(0.0, 94.56578255572956)
Out[15]:
Text(0.5, 0, ' Cash Flow to Equity')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb999e059d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998f7a790>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998f7a790>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998f7a790>
Out[15]:
(0.0, 27.41263634096526)
Out[15]:
Text(0.5, 0, ' Current Liability to Current Assets')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb998f86590>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998f40d50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998f40d50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998f40d50>
Out[15]:
(0.0, 128.28374939958357)
Out[15]:
Text(0.5, 0, ' Liability-Assets Flag')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb998d74550>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998d03dd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998d03dd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998d03dd0>
Out[15]:
(0.0, 18.9363360641386)
Out[15]:
Text(0.5, 0, ' Net Income to Total Assets')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb998da8190>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998c19d10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998c19d10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998c19d10>
Out[15]:
(0.0, 1e-12)
Out[15]:
Text(0.5, 0, ' Total assets to GNP price')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb998c85e90>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998a9a090>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998a9a090>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998a9a090>
Out[15]:
(0.0, 378.12115050576483)
Out[15]:
Text(0.5, 0, ' No-credit Interval')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb9989e7750>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9988be2d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9988be2d0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9988be2d0>
Out[15]:
(0.0, 60.632603511695734)
Out[15]:
Text(0.5, 0, ' Gross Profit to Sales')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb9989eebd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9988bee10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9988bee10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9988bee10>
Out[15]:
(0.0, 223.69695588458234)
Out[15]:
Text(0.5, 0, " Net Income to Stockholder's Equity")
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb998679890>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9985aad50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9985aad50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9985aad50>
Out[15]:
(0.0, 138.46415138943863)
Out[15]:
Text(0.5, 0, ' Liability to Equity')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb99842cbd0>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99849e450>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99849e450>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99849e450>
Out[15]:
(0.0, 190.85697417360217)
Out[15]:
Text(0.5, 0, ' Degree of Financial Leverage (DFL)')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb9982afa10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9982afe50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9982afe50>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9982afe50>
Out[15]:
(0.0, 306.8123238053698)
Out[15]:
Text(0.5, 0, ' Interest Coverage Ratio (Interest expense to EBIT)')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb998387490>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998288110>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998288110>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998288110>
Out[15]:
(0.0, 52.49999999999996)
Out[15]:
Text(0.5, 0, ' Net Income Flag')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb9987f8b10>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9980d4310>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9980d4310>
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9980d4310>
Out[15]:
(0.0, 39.36327603696296)
Out[15]:
Text(0.5, 0, ' Equity to Liability')
Out[15]:
Text(0, 0.5, 'Bankrupt?')
Out[15]:
<matplotlib.legend.Legend at 0x7fb9980b0cd0>

Figure 4: Distribution plot, split by target variable Y=0 and Y=1

In [16]:
pd.Series(index=['min','max'],data=[df.min(),df.max()]) # double check min, max
Out[16]:
min                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Bankrupt?                                                   0.0
 ROA(C) before interest and depreciation before interest    0.0
 ROA(A) before interest and % after tax                     0.0
 ROA(B) before interest and depreciation after tax          0.0
 Operating Gross Margin                                     0.0
 Realized Sales Gross Margin                                0.0
 Operating Profit Rate                                      0.0
 Pre-tax net Interest Rate                                  0.0
 After-tax net Interest Rate                                0.0
 Non-industry income and expenditure/revenue                0.0
 Continuous interest rate (after tax)                       0.0
 Operating Expense Rate                                     0.0
 Research and development expense rate                      0.0
 Cash flow rate                                             0.0
 Interest-bearing debt interest rate                        0.0
 Tax rate (A)                                               0.0
 Net Value Per Share (B)                                    0.0
 Net Value Per Share (A)                                    0.0
 Net Value Per Share (C)                                    0.0
 Persistent EPS in the Last Four Seasons                    0.0
 Cash Flow Per Share                                        0.0
 Revenue Per Share (Yuan ¥)                                 0.0
 Operating Profit Per Share (Yuan ¥)                        0.0
 Per Share Net profit before tax (Yuan ¥)                   0.0
 Realized Sales Gross Profit Growth Rate                    0.0
 Operating Profit Growth Rate                               0.0
 After-tax Net Profit Growth Rate                           0.0
 Regular Net Profit Growth Rate                             0.0
 Continuous Net Profit Growth Rate                          0.0
 Total Asset Growth Rate                                    0.0
 Net Value Growth Rate                                      0.0
 Total Asset Return Growth Rate Ratio                       0.0
 Cash Reinvestment %                                        0.0
 Current Ratio                                              0.0
 Quick Ratio                                                0.0
 Interest Expense Ratio                                     0.0
 Total debt/Total net worth                                 0.0
 Debt ratio %                                               0.0
 Net worth/Assets                                           0.0
 Long-term fund suitability ratio (A)                       0.0
 Borrowing dependency                                       0.0
 Contingent liabilities/Net worth                           0.0
 Operating profit/Paid-in capital                           0.0
 Net profit before tax/Paid-in capital                      0.0
 Inventory and accounts receivable/Net value                0.0
 Total Asset Turnover                                       0.0
 Accounts Receivable Turnover                               0.0
 Average Collection Days                                    0.0
 Inventory Turnover Rate (times)                            0.0
 Fixed Assets Turnover Frequency                            0.0
 Net Worth Turnover Rate (times)                            0.0
 Revenue per person                                         0.0
 Operating profit per person                                0.0
 Allocation rate per person                                 0.0
 Working Capital to Total Assets                            0.0
 Quick Assets/Total Assets                                  0.0
 Current Assets/Total Assets                                0.0
 Cash/Total Assets                                          0.0
 Quick Assets/Current Liability                             0.0
 Cash/Current Liability                                     0.0
 Current Liability to Assets                                0.0
 Operating Funds to Liability                               0.0
 Inventory/Working Capital                                  0.0
 Inventory/Current Liability                                0.0
 Current Liabilities/Liability                              0.0
 Working Capital/Equity                                     0.0
 Current Liabilities/Equity                                 0.0
 Long-term Liability to Current Assets                      0.0
 Retained Earnings to Total Assets                          0.0
 Total income/Total expense                                 0.0
 Total expense/Assets                                       0.0
 Current Asset Turnover Rate                                0.0
 Quick Asset Turnover Rate                                  0.0
 Working capitcal Turnover Rate                             0.0
 Cash Turnover Rate                                         0.0
 Cash Flow to Sales                                         0.0
 Fixed Assets to Assets                                     0.0
 Current Liability to Liability                             0.0
 Current Liability to Equity                                0.0
 Equity to Long-term Liability                              0.0
 Cash Flow to Total Assets                                  0.0
 Cash Flow to Liability                                     0.0
 CFO to Assets                                              0.0
 Cash Flow to Equity                                        0.0
 Current Liability to Current Assets                        0.0
 Liability-Assets Flag                                      0.0
 Net Income to Total Assets                                 0.0
 Total assets to GNP price                                  0.0
 No-credit Interval                                         0.0
 Gross Profit to Sales                                      0.0
 Net Income to Stockholder's Equity                         0.0
 Liability to Equity                                        0.0
 Degree of Financial Leverage (DFL)                         0.0
 Interest Coverage Ratio (Interest expense to EBIT)         0.0
 Net Income Flag                                            1.0
 Equity to Liability                                        0.0
dtype: float64
max    Bankrupt?                                                   1.000000e+00
 ROA(C) before interest and depreciation before interest    1.000000e+00
 ROA(A) before interest and % after tax                     1.000000e+00
 ROA(B) before interest and depreciation after tax          1.000000e+00
 Operating Gross Margin                                     1.000000e+00
 Realized Sales Gross Margin                                1.000000e+00
 Operating Profit Rate                                      1.000000e+00
 Pre-tax net Interest Rate                                  1.000000e+00
 After-tax net Interest Rate                                1.000000e+00
 Non-industry income and expenditure/revenue                1.000000e+00
 Continuous interest rate (after tax)                       1.000000e+00
 Operating Expense Rate                                     9.990000e+09
 Research and development expense rate                      9.980000e+09
 Cash flow rate                                             1.000000e+00
 Interest-bearing debt interest rate                        9.900000e+08
 Tax rate (A)                                               1.000000e+00
 Net Value Per Share (B)                                    1.000000e+00
 Net Value Per Share (A)                                    1.000000e+00
 Net Value Per Share (C)                                    1.000000e+00
 Persistent EPS in the Last Four Seasons                    1.000000e+00
 Cash Flow Per Share                                        1.000000e+00
 Revenue Per Share (Yuan ¥)                                 3.020000e+09
 Operating Profit Per Share (Yuan ¥)                        1.000000e+00
 Per Share Net profit before tax (Yuan ¥)                   1.000000e+00
 Realized Sales Gross Profit Growth Rate                    1.000000e+00
 Operating Profit Growth Rate                               1.000000e+00
 After-tax Net Profit Growth Rate                           1.000000e+00
 Regular Net Profit Growth Rate                             1.000000e+00
 Continuous Net Profit Growth Rate                          1.000000e+00
 Total Asset Growth Rate                                    9.990000e+09
 Net Value Growth Rate                                      9.330000e+09
 Total Asset Return Growth Rate Ratio                       1.000000e+00
 Cash Reinvestment %                                        1.000000e+00
 Current Ratio                                              2.750000e+09
 Quick Ratio                                                9.230000e+09
 Interest Expense Ratio                                     1.000000e+00
 Total debt/Total net worth                                 9.940000e+09
 Debt ratio %                                               1.000000e+00
 Net worth/Assets                                           1.000000e+00
 Long-term fund suitability ratio (A)                       1.000000e+00
 Borrowing dependency                                       1.000000e+00
 Contingent liabilities/Net worth                           1.000000e+00
 Operating profit/Paid-in capital                           1.000000e+00
 Net profit before tax/Paid-in capital                      1.000000e+00
 Inventory and accounts receivable/Net value                1.000000e+00
 Total Asset Turnover                                       1.000000e+00
 Accounts Receivable Turnover                               9.740000e+09
 Average Collection Days                                    9.730000e+09
 Inventory Turnover Rate (times)                            9.990000e+09
 Fixed Assets Turnover Frequency                            9.990000e+09
 Net Worth Turnover Rate (times)                            1.000000e+00
 Revenue per person                                         8.810000e+09
 Operating profit per person                                1.000000e+00
 Allocation rate per person                                 9.570000e+09
 Working Capital to Total Assets                            1.000000e+00
 Quick Assets/Total Assets                                  1.000000e+00
 Current Assets/Total Assets                                1.000000e+00
 Cash/Total Assets                                          1.000000e+00
 Quick Assets/Current Liability                             8.820000e+09
 Cash/Current Liability                                     9.650000e+09
 Current Liability to Assets                                1.000000e+00
 Operating Funds to Liability                               1.000000e+00
 Inventory/Working Capital                                  1.000000e+00
 Inventory/Current Liability                                9.910000e+09
 Current Liabilities/Liability                              1.000000e+00
 Working Capital/Equity                                     1.000000e+00
 Current Liabilities/Equity                                 1.000000e+00
 Long-term Liability to Current Assets                      9.540000e+09
 Retained Earnings to Total Assets                          1.000000e+00
 Total income/Total expense                                 1.000000e+00
 Total expense/Assets                                       1.000000e+00
 Current Asset Turnover Rate                                1.000000e+10
 Quick Asset Turnover Rate                                  1.000000e+10
 Working capitcal Turnover Rate                             1.000000e+00
 Cash Turnover Rate                                         1.000000e+10
 Cash Flow to Sales                                         1.000000e+00
 Fixed Assets to Assets                                     8.320000e+09
 Current Liability to Liability                             1.000000e+00
 Current Liability to Equity                                1.000000e+00
 Equity to Long-term Liability                              1.000000e+00
 Cash Flow to Total Assets                                  1.000000e+00
 Cash Flow to Liability                                     1.000000e+00
 CFO to Assets                                              1.000000e+00
 Cash Flow to Equity                                        1.000000e+00
 Current Liability to Current Assets                        1.000000e+00
 Liability-Assets Flag                                      1.000000e+00
 Net Income to Total Assets                                 1.000000e+00
 Total assets to GNP price                                  9.820000e+09
 No-credit Interval                                         1.000000e+00
 Gross Profit to Sales                                      1.000000e+00
 Net Income to Stockholder's Equity                         1.000000e+00
 Liability to Equity                                        1.000000e+00
 Degree of Financial Leverage (DFL)                         1.000000e+00
 Interest Coverage Ratio (Interest expense to EBIT)         1.000000e+00
 Net Income Flag                                            1.000000e+00
 Equity to Liability                                        1.000000e+00
dtype: float64
dtype: object

Figure 5: Transform and scale skewed variables

In [17]:
#  log and max-min transform Independent Variabe
def data_trans(df):
    
    for col in df:
        skew = df[col].skew()
        max = df[col].max()
        if ((skew > 0.5 or skew < -0.5) and max >1):
            print(col)
            df[col] = np.log1p(df[col])
            df[col] = (df[col]-(df[col]).min())/((df[col]).max()-(df[col]).min())
        else:
            continue
            
    return df

df_norm = data_trans(df)
 Operating Expense Rate
 Research and development expense rate
 Interest-bearing debt interest rate
 Revenue Per Share (Yuan ¥)
 Total Asset Growth Rate
 Net Value Growth Rate
 Current Ratio
 Quick Ratio
 Total debt/Total net worth
 Accounts Receivable Turnover
 Average Collection Days
 Inventory Turnover Rate (times)
 Fixed Assets Turnover Frequency
 Revenue per person
 Allocation rate per person
 Quick Assets/Current Liability
 Cash/Current Liability
 Inventory/Current Liability
 Long-term Liability to Current Assets
 Current Asset Turnover Rate
 Quick Asset Turnover Rate
 Cash Turnover Rate
 Fixed Assets to Assets
 Total assets to GNP price
In [18]:
df_norm.describe()
Out[18]:
Bankrupt? ROA(C) before interest and depreciation before interest ROA(A) before interest and % after tax ROA(B) before interest and depreciation after tax Operating Gross Margin Realized Sales Gross Margin Operating Profit Rate Pre-tax net Interest Rate After-tax net Interest Rate Non-industry income and expenditure/revenue Continuous interest rate (after tax) Operating Expense Rate Research and development expense rate Cash flow rate Interest-bearing debt interest rate Tax rate (A) Net Value Per Share (B) Net Value Per Share (A) Net Value Per Share (C) Persistent EPS in the Last Four Seasons Cash Flow Per Share Revenue Per Share (Yuan ¥) Operating Profit Per Share (Yuan ¥) Per Share Net profit before tax (Yuan ¥) Realized Sales Gross Profit Growth Rate Operating Profit Growth Rate After-tax Net Profit Growth Rate Regular Net Profit Growth Rate Continuous Net Profit Growth Rate Total Asset Growth Rate Net Value Growth Rate Total Asset Return Growth Rate Ratio Cash Reinvestment % Current Ratio Quick Ratio Interest Expense Ratio Total debt/Total net worth Debt ratio % Net worth/Assets Long-term fund suitability ratio (A) ... Current Assets/Total Assets Cash/Total Assets Quick Assets/Current Liability Cash/Current Liability Current Liability to Assets Operating Funds to Liability Inventory/Working Capital Inventory/Current Liability Current Liabilities/Liability Working Capital/Equity Current Liabilities/Equity Long-term Liability to Current Assets Retained Earnings to Total Assets Total income/Total expense Total expense/Assets Current Asset Turnover Rate Quick Asset Turnover Rate Working capitcal Turnover Rate Cash Turnover Rate Cash Flow to Sales Fixed Assets to Assets Current Liability to Liability Current Liability to Equity Equity to Long-term Liability Cash Flow to Total Assets Cash Flow to Liability CFO to Assets Cash Flow to Equity Current Liability to Current Assets Liability-Assets Flag Net Income to Total Assets Total assets to GNP price No-credit Interval Gross Profit to Sales Net Income to Stockholder's Equity Liability to Equity Degree of Financial Leverage (DFL) Interest Coverage Ratio (Interest expense to EBIT) Net Income Flag Equity to Liability
count 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 ... 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.000000 6819.0 6819.000000
mean 0.032263 0.505180 0.558625 0.553589 0.607948 0.607929 0.998755 0.797190 0.809084 0.303623 0.781381 0.323501 0.549516 0.467431 0.030200 0.115001 0.190661 0.190633 0.190672 0.228813 0.323482 0.002428 0.109091 0.184361 0.022408 0.847980 0.689146 0.689150 0.217639 0.857687 0.000309 0.264248 0.379677 0.000827 0.001768 0.630991 0.001441 0.113177 0.886823 0.008783 ... 0.522273 0.124095 0.000943 0.007044 0.090673 0.353828 0.277395 0.013917 0.761599 0.735817 0.331410 0.015042 0.934733 0.002549 0.029184 0.175794 0.338797 0.594006 0.585098 0.671531 0.009367 0.761599 0.331410 0.115645 0.649731 0.461849 0.593415 0.315582 0.031506 0.001173 0.807760 0.003208 0.623915 0.607946 0.840402 0.280365 0.027541 0.565358 1.0 0.047578
std 0.176710 0.060686 0.065620 0.061595 0.016934 0.016916 0.013010 0.012869 0.013601 0.011163 0.012679 0.456843 0.458690 0.017036 0.165644 0.138667 0.033390 0.033474 0.033480 0.033263 0.017611 0.026400 0.027942 0.033180 0.012079 0.010752 0.013853 0.013910 0.010063 0.314909 0.016423 0.009634 0.020737 0.012135 0.035595 0.011238 0.032155 0.053920 0.053920 0.028153 ... 0.218112 0.139251 0.020900 0.078860 0.050290 0.035147 0.010469 0.111745 0.206677 0.011678 0.013488 0.115947 0.025564 0.012093 0.027149 0.374397 0.462810 0.008959 0.458235 0.009341 0.013733 0.206677 0.013488 0.019529 0.047372 0.029943 0.058561 0.012961 0.030845 0.034234 0.040332 0.052642 0.012290 0.016934 0.014523 0.014463 0.015668 0.013214 0.0 0.050014
min 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ... 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.0 0.000000
25% 0.000000 0.476527 0.535543 0.527277 0.600445 0.600434 0.998969 0.797386 0.809312 0.303466 0.781567 0.000007 0.000006 0.461558 0.000010 0.000000 0.173613 0.173613 0.173676 0.214711 0.317748 0.000711 0.096083 0.170370 0.022065 0.847984 0.689270 0.689270 0.217580 0.968706 0.000019 0.263759 0.374749 0.000346 0.000205 0.630612 0.000130 0.072891 0.851196 0.005244 ... 0.352845 0.033543 0.000228 0.000086 0.053301 0.341023 0.277034 0.000137 0.626981 0.733612 0.328096 0.000000 0.931097 0.002236 0.014567 0.000006 0.000006 0.593934 0.000012 0.671565 0.003586 0.626981 0.328096 0.110933 0.633265 0.457116 0.565987 0.312995 0.018034 0.000000 0.796750 0.000039 0.623636 0.600443 0.840115 0.276944 0.026791 0.565158 1.0 0.024477
50% 0.000000 0.502706 0.559802 0.552278 0.605997 0.605976 0.999022 0.797464 0.809375 0.303525 0.781635 0.000012 0.870747 0.465080 0.000015 0.073489 0.184400 0.184400 0.184400 0.224544 0.322487 0.001237 0.104226 0.179709 0.022102 0.848044 0.689439 0.689439 0.217598 0.980661 0.000020 0.264050 0.380425 0.000485 0.000322 0.630698 0.000240 0.111407 0.888593 0.005665 ... 0.514830 0.074887 0.000344 0.000213 0.082705 0.348597 0.277178 0.000281 0.806881 0.736013 0.329685 0.000086 0.937672 0.002336 0.022674 0.000009 0.000010 0.593963 0.903342 0.671574 0.007868 0.806881 0.329685 0.112340 0.645366 0.459750 0.593266 0.314953 0.027597 0.000000 0.810619 0.000091 0.623879 0.605998 0.841179 0.278778 0.026808 0.565252 1.0 0.033798
75% 0.000000 0.535563 0.589157 0.584105 0.613914 0.613842 0.999095 0.797579 0.809469 0.303585 0.781735 0.961794 0.953865 0.471004 0.000026 0.205841 0.199570 0.199570 0.199612 0.238820 0.328623 0.002076 0.116155 0.193493 0.022153 0.848123 0.689647 0.689647 0.217622 0.986907 0.000022 0.264388 0.386731 0.000743 0.000531 0.631125 0.000401 0.148804 0.927109 0.006847 ... 0.689051 0.161073 0.000562 0.000553 0.119523 0.360915 0.277429 0.000482 0.942027 0.738560 0.332322 0.000390 0.944811 0.002492 0.035930 0.000020 0.969020 0.594002 0.965418 0.671587 0.013852 0.942027 0.332322 0.117106 0.663062 0.464236 0.624769 0.317707 0.038375 0.000000 0.826455 0.000228 0.624168 0.613913 0.842357 0.281449 0.026913 0.565725 1.0 0.052838
max 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 ... 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.0 1.000000

8 rows × 96 columns

Figure 6: Display max-min scaling

In [19]:
fig, axs = plt.subplots(ncols=2, nrows=0, figsize=(12, 200))
plt.subplots_adjust(right=2)
plt.subplots_adjust(top=2)
for i, col in enumerate(list(df_norm), 1):
  plt.subplot(len(list(df_norm)), 3, i)
  sns.set_style("white")
  x1 = df_norm.loc[df_norm['Bankrupt?']==1,[col]]
  x2 = df_norm.loc[df_norm['Bankrupt?']==0,[col]]
  # Plot
  #kwargs = dict(hist_kws={'alpha':.6}, kde_kws={'linewidth':2})
  #plt.figure(figsize=(10,7), dpi= 80)
  sns.distplot(x1, color="dodgerblue", label="Bankrupt")
  sns.distplot(x2, color="orange", label="Not Bankrupt")
  plt.ylim(0,None) 
  plt.xlabel('{}'.format(col), size=15,labelpad=12.5)
  plt.ylabel('Bankrupt?', size=15, labelpad=12.5)

  for j in range(2):
      plt.tick_params(axis='x', labelsize=12)
      plt.tick_params(axis='y', labelsize=12)
#plt.xlabel(col)
  plt.legend(loc='best', prop={'size': 10})
        
plt.show()
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9974e5910>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9974e5910>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9974e5910>
Out[19]:
(0.0, 52.49999999999996)
Out[19]:
Text(0.5, 0, 'Bankrupt?')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99a77fe10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a76aad0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a76aad0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a76aad0>
Out[19]:
(0.0, 10.286785876647969)
Out[19]:
Text(0.5, 0, ' ROA(C) before interest and depreciation before interest')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99faa69d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a76abd0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a76abd0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99a76abd0>
Out[19]:
(0.0, 11.44001426190167)
Out[19]:
Text(0.5, 0, ' ROA(A) before interest and % after tax')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9a166f310>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998e9e050>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998e9e050>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb998e9e050>
Out[19]:
(0.0, 11.217608728595232)
Out[19]:
Text(0.5, 0, ' ROA(B) before interest and depreciation after tax')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9972fae10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9972faa10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9972faa10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9972faa10>
Out[19]:
(0.0, 60.63143720584567)
Out[19]:
Text(0.5, 0, ' Operating Gross Margin')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb997307b10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9972be4d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9972be4d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9972be4d0>
Out[19]:
(0.0, 59.11565127569953)
Out[19]:
Text(0.5, 0, ' Realized Sales Gross Margin')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb997250710>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9972fa810>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9972fa810>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9972fa810>
Out[19]:
(0.0, 2559.356676183361)
Out[19]:
Text(0.5, 0, ' Operating Profit Rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99f7d6c90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f1dd090>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f1dd090>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f1dd090>
Out[19]:
(0.0, 888.7409516868166)
Out[19]:
Text(0.5, 0, ' Pre-tax net Interest Rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99efe61d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cb4b210>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cb4b210>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99cb4b210>
Out[19]:
(0.0, 822.867087060867)
Out[19]:
Text(0.5, 0, ' After-tax net Interest Rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99db81f10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f712690>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f712690>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99f712690>
Out[19]:
(0.0, 627.9337458090101)
Out[19]:
Text(0.5, 0, ' Non-industry income and expenditure/revenue')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb996e71ed0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996da5050>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996da5050>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996da5050>
Out[19]:
(0.0, 982.4080182746294)
Out[19]:
Text(0.5, 0, ' Continuous interest rate (after tax)')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb996baef50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996bae810>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996bae810>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996bae810>
Out[19]:
(0.0, 6.975602363994544)
Out[19]:
Text(0.5, 0, ' Operating Expense Rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb996d02150>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996c8e610>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996c8e610>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996c8e610>
Out[19]:
(0.0, 4.615926655553873)
Out[19]:
Text(0.5, 0, ' Research and development expense rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb996ac3a90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996ad5350>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996ad5350>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996ad5350>
Out[19]:
(0.0, 120.9648944805199)
Out[19]:
Text(0.5, 0, ' Cash flow rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9969c7c10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996b75350>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996b75350>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996b75350>
Out[19]:
(0.0, 54.20503691527692)
Out[19]:
Text(0.5, 0, ' Interest-bearing debt interest rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb996a19e90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9969bf710>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9969bf710>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9969bf710>
Out[19]:
(0.0, 19.29365055311411)
Out[19]:
Text(0.5, 0, ' Tax rate (A)')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99675e250>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9966df510>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9966df510>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9966df510>
Out[19]:
(0.0, 23.638872763266193)
Out[19]:
Text(0.5, 0, ' Net Value Per Share (B)')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9965efd90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996631650>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996631650>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996631650>
Out[19]:
(0.0, 23.638872763266193)
Out[19]:
Text(0.5, 0, ' Net Value Per Share (A)')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb996507f90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99642f2d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99642f2d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99642f2d0>
Out[19]:
(0.0, 27.77087084790204)
Out[19]:
Text(0.5, 0, ' Net Value Per Share (C)')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9963c2310>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996353950>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996353950>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996353950>
Out[19]:
(0.0, 24.10331547401718)
Out[19]:
Text(0.5, 0, ' Persistent EPS in the Last Four Seasons')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9962de7d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996b8dc10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996b8dc10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996b8dc10>
Out[19]:
(0.0, 72.49354988564909)
Out[19]:
Text(0.5, 0, ' Cash Flow Per Share')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99625fb90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996027110>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996027110>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb996027110>
Out[19]:
(0.0, 677.9625404891425)
Out[19]:
Text(0.5, 0, ' Revenue Per Share (Yuan ¥)')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9960dec90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995fe2410>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995fe2410>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995fe2410>
Out[19]:
(0.0, 40.367876141325716)
Out[19]:
Text(0.5, 0, ' Operating Profit Per Share (Yuan ¥)')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9960ded50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995e88510>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995e88510>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995e88510>
Out[19]:
(0.0, 25.28453704754437)
Out[19]:
Text(0.5, 0, ' Per Share Net profit before tax (Yuan ¥)')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb995cdd610>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995cdd310>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995cdd310>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995cdd310>
Out[19]:
(0.0, 794.6507675208318)
Out[19]:
Text(0.5, 0, ' Realized Sales Gross Profit Growth Rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb995b5b7d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995aefd10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995aefd10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995aefd10>
Out[19]:
(0.0, 430.43466662109705)
Out[19]:
Text(0.5, 0, ' Operating Profit Growth Rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb995aaf8d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99596ae10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99596ae10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99596ae10>
Out[19]:
(0.0, 235.88384508891284)
Out[19]:
Text(0.5, 0, ' After-tax Net Profit Growth Rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99585d610>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995864e50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995864e50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995864e50>
Out[19]:
(0.0, 166.00080774078765)
Out[19]:
Text(0.5, 0, ' Regular Net Profit Growth Rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99573e710>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99567f410>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99567f410>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99567f410>
Out[19]:
(0.0, 866.754410591733)
Out[19]:
Text(0.5, 0, ' Continuous Net Profit Growth Rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99556bed0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99555cd10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99555cd10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99555cd10>
Out[19]:
(0.0, 28.258827095014375)
Out[19]:
Text(0.5, 0, ' Total Asset Growth Rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9954c4450>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9954ff3d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9954ff3d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9954ff3d0>
Out[19]:
(0.0, 179.1974015356601)
Out[19]:
Text(0.5, 0, ' Net Value Growth Rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9954dccd0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99538f5d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99538f5d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99538f5d0>
Out[19]:
(0.0, 650.3368716576879)
Out[19]:
Text(0.5, 0, ' Total Asset Return Growth Rate Ratio')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb995341cd0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995146910>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995146910>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995146910>
Out[19]:
(0.0, 44.12466983639061)
Out[19]:
Text(0.5, 0, ' Cash Reinvestment %')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb994f711d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994efa950>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994efa950>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994efa950>
Out[19]:
(0.0, 2796.1274443378616)
Out[19]:
Text(0.5, 0, ' Current Ratio')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb994ddb290>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994d87250>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994d87250>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994d87250>
Out[19]:
(0.0, 65.11168938377206)
Out[19]:
Text(0.5, 0, ' Quick Ratio')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb994c6e490>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994c04c10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994c04c10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994c04c10>
Out[19]:
(0.0, 160.83422904699677)
Out[19]:
Text(0.5, 0, ' Interest Expense Ratio')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb994bf6b90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994a74710>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994a74710>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994a74710>
Out[19]:
(0.0, 79.12248959016969)
Out[19]:
Text(0.5, 0, ' Total debt/Total net worth')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb994a47050>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994a39f50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994a39f50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994a39f50>
Out[19]:
(0.0, 12.142953641238549)
Out[19]:
Text(0.5, 0, ' Debt ratio %')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb996ec4690>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99642fc50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99642fc50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99642fc50>
Out[19]:
(0.0, 12.142953641238492)
Out[19]:
Text(0.5, 0, ' Net worth/Assets')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99e533210>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995df6290>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995df6290>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb995df6290>
Out[19]:
(0.0, 81.08501254188234)
Out[19]:
Text(0.5, 0, ' Long-term fund suitability ratio (A)')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9963f5a10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994618f50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994618f50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994618f50>
Out[19]:
(0.0, 118.24461454163)
Out[19]:
Text(0.5, 0, ' Borrowing dependency')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb994425850>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994618fd0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994618fd0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994618fd0>
Out[19]:
(0.0, 973.5123127859379)
Out[19]:
Text(0.5, 0, ' Contingent liabilities/Net worth')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9942c6050>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99438df50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99438df50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99438df50>
Out[19]:
(0.0, 37.73641762604199)
Out[19]:
Text(0.5, 0, ' Operating profit/Paid-in capital')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9941aa150>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994096f50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994096f50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994096f50>
Out[19]:
(0.0, 26.43313584988755)
Out[19]:
Text(0.5, 0, ' Net profit before tax/Paid-in capital')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99403b0d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994096c90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994096c90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb994096c90>
Out[19]:
(0.0, 84.53881493903849)
Out[19]:
Text(0.5, 0, ' Inventory and accounts receivable/Net value')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb993fc8910>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993e52410>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993e52410>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993e52410>
Out[19]:
(0.0, 8.91354545454546)
Out[19]:
Text(0.5, 0, ' Total Asset Turnover')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb993f87f10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993d88cd0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993d88cd0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993d88cd0>
Out[19]:
(0.0, 57.45092326528909)
Out[19]:
Text(0.5, 0, ' Accounts Receivable Turnover')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb993ccff50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993b2b210>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993b2b210>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993b2b210>
Out[19]:
(0.0, 63.860084680317804)
Out[19]:
Text(0.5, 0, ' Average Collection Days')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb993cc7ad0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993a0ed90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993a0ed90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993a0ed90>
Out[19]:
(0.0, 6.000227307167753)
Out[19]:
Text(0.5, 0, ' Inventory Turnover Rate (times)')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb993985750>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99391e310>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99391e310>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99391e310>
Out[19]:
(0.0, 43.37475375056827)
Out[19]:
Text(0.5, 0, ' Fixed Assets Turnover Frequency')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb993adadd0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993827b50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993827b50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993827b50>
Out[19]:
(0.0, 30.18272727272723)
Out[19]:
Text(0.5, 0, ' Net Worth Turnover Rate (times)')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9937ff190>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99369e290>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99369e290>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99369e290>
Out[19]:
(0.0, 101.92089304577277)
Out[19]:
Text(0.5, 0, ' Revenue per person')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb993916d50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99359c390>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99359c390>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99359c390>
Out[19]:
(0.0, 52.57156194378182)
Out[19]:
Text(0.5, 0, ' Operating profit per person')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99352acd0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99345ff10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99345ff10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99345ff10>
Out[19]:
(0.0, 61.00038347491807)
Out[19]:
Text(0.5, 0, ' Allocation rate per person')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9934123d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99392fa10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99392fa10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99392fa10>
Out[19]:
(0.0, 7.576264891690021)
Out[19]:
Text(0.5, 0, ' Working Capital to Total Assets')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9931b3b50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99328ba90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99328ba90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99328ba90>
Out[19]:
(0.0, 2.184762674131061)
Out[19]:
Text(0.5, 0, ' Quick Assets/Total Assets')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99301fa90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993358a10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993358a10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb993358a10>
Out[19]:
(0.0, 1.8088195181088054)
Out[19]:
Text(0.5, 0, ' Current Assets/Total Assets')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb992f5bf10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99300ec90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99300ec90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99300ec90>
Out[19]:
(0.0, 25.63325908642265)
Out[19]:
Text(0.5, 0, ' Cash/Total Assets')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb993095b10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb992e1dc50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb992e1dc50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb992e1dc50>
Out[19]:
(0.0, 3577.4880557642664)
Out[19]:
Text(0.5, 0, ' Quick Assets/Current Liability')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb992d8c2d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb992cb1110>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb992cb1110>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb992cb1110>
Out[19]:
(0.0, 52.229504470374295)
Out[19]:
Text(0.5, 0, ' Cash/Current Liability')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb992b79910>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb992b95a10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb992b95a10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb992b95a10>
Out[19]:
(0.0, 9.466017122995527)
Out[19]:
Text(0.5, 0, ' Current Liability to Assets')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb992c617d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb992a43ad0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb992a43ad0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb992a43ad0>
Out[19]:
(0.0, 43.49674116980162)
Out[19]:
Text(0.5, 0, ' Operating Funds to Liability')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb992a14050>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9928b7b50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9928b7b50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9928b7b50>
Out[19]:
(0.0, 343.617405574133)
Out[19]:
Text(0.5, 0, ' Inventory/Working Capital')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb992a38ed0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb992716f10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb992716f10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb992716f10>
Out[19]:
(0.0, 52.05532642489921)
Out[19]:
Text(0.5, 0, ' Inventory/Current Liability')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb992749610>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9925cde10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9925cde10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9925cde10>
Out[19]:
(0.0, 5.938172450371269)
Out[19]:
Text(0.5, 0, ' Current Liabilities/Liability')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9925c1e50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99252c7d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99252c7d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99252c7d0>
Out[19]:
(0.0, 108.80607593957842)
Out[19]:
Text(0.5, 0, ' Working Capital/Equity')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99252c750>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99231a650>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99231a650>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99231a650>
Out[19]:
(0.0, 160.34732355173645)
Out[19]:
Text(0.5, 0, ' Current Liabilities/Equity')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99234d110>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9921aee50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9921aee50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9921aee50>
Out[19]:
(0.0, 52.49128430880509)
Out[19]:
Text(0.5, 0, ' Long-term Liability to Current Assets')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb992107a10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9920ea8d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9920ea8d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9920ea8d0>
Out[19]:
(0.0, 37.14091245209042)
Out[19]:
Text(0.5, 0, ' Retained Earnings to Total Assets')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb992018510>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991f9b310>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991f9b310>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991f9b310>
Out[19]:
(0.0, 4046.828392528158)
Out[19]:
Text(0.5, 0, ' Total income/Total expense')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb991e79b10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991e793d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991e793d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991e793d0>
Out[19]:
(0.0, 31.1099394279351)
Out[19]:
Text(0.5, 0, ' Total expense/Assets')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb991d45990>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991e02f50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991e02f50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991e02f50>
Out[19]:
(0.0, 43.09630247007122)
Out[19]:
Text(0.5, 0, ' Current Asset Turnover Rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb991bce090>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991c27390>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991c27390>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991c27390>
Out[19]:
(0.0, 6.862660510853095)
Out[19]:
Text(0.5, 0, ' Quick Asset Turnover Rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb991baccd0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991aea550>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991aea550>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991aea550>
Out[19]:
(0.0, 1352.0234365728438)
Out[19]:
Text(0.5, 0, ' Working capitcal Turnover Rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb991abbfd0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991aa6710>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991aa6710>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991aa6710>
Out[19]:
(0.0, 6.798153116000368)
Out[19]:
Text(0.5, 0, ' Cash Turnover Rate')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb991838d50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991970650>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991970650>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991970650>
Out[19]:
(0.0, 38883.512991169184)
Out[19]:
Text(0.5, 0, ' Cash Flow to Sales')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9918bde90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991748790>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991748790>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991748790>
Out[19]:
(0.0, 76.2524758697267)
Out[19]:
Text(0.5, 0, ' Fixed Assets to Assets')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9916cfb50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9915cbc90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9915cbc90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9915cbc90>
Out[19]:
(0.0, 5.938172450371269)
Out[19]:
Text(0.5, 0, ' Current Liability to Liability')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb994434650>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9946c4c50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9946c4c50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9946c4c50>
Out[19]:
(0.0, 160.34732355173645)
Out[19]:
Text(0.5, 0, ' Current Liability to Equity')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99149e490>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9935497d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9935497d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9935497d0>
Out[19]:
(0.0, 97.70098617251905)
Out[19]:
Text(0.5, 0, ' Equity to Long-term Liability')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99454a2d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9914db4d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9914db4d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9914db4d0>
Out[19]:
(0.0, 36.833285761806124)
Out[19]:
Text(0.5, 0, ' Cash Flow to Total Assets')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9910c73d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9910be190>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9910be190>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9910be190>
Out[19]:
(0.0, 100.3918192477624)
Out[19]:
Text(0.5, 0, ' Cash Flow to Liability')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb990f450d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991014d90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991014d90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb991014d90>
Out[19]:
(0.0, 10.812397794766909)
Out[19]:
Text(0.5, 0, ' CFO to Assets')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb990d32e90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99116ce50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99116ce50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99116ce50>
Out[19]:
(0.0, 94.56578255572956)
Out[19]:
Text(0.5, 0, ' Cash Flow to Equity')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb990dad9d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990bbb7d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990bbb7d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990bbb7d0>
Out[19]:
(0.0, 27.41263634096526)
Out[19]:
Text(0.5, 0, ' Current Liability to Current Assets')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb990b0e8d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990af2350>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990af2350>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990af2350>
Out[19]:
(0.0, 128.28374939958357)
Out[19]:
Text(0.5, 0, ' Liability-Assets Flag')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb990cf5810>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990b7f790>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990b7f790>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990b7f790>
Out[19]:
(0.0, 18.9363360641386)
Out[19]:
Text(0.5, 0, ' Net Income to Total Assets')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9909e2850>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990941a50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990941a50>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990941a50>
Out[19]:
(0.0, 52.35679648431581)
Out[19]:
Text(0.5, 0, ' Total assets to GNP price')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9907a88d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99065db90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99065db90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99065db90>
Out[19]:
(0.0, 378.12115050576483)
Out[19]:
Text(0.5, 0, ' No-credit Interval')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9909418d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990639050>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990639050>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990639050>
Out[19]:
(0.0, 60.632603511695734)
Out[19]:
Text(0.5, 0, ' Gross Profit to Sales')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb9904ba4d0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99065dad0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99065dad0>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb99065dad0>
Out[19]:
(0.0, 223.69695588458234)
Out[19]:
Text(0.5, 0, " Net Income to Stockholder's Equity")
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb990390750>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9902cd650>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9902cd650>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9902cd650>
Out[19]:
(0.0, 138.46415138943863)
Out[19]:
Text(0.5, 0, ' Liability to Equity')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb99065dd10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990070750>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990070750>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990070750>
Out[19]:
(0.0, 190.85697417360217)
Out[19]:
Text(0.5, 0, ' Degree of Financial Leverage (DFL)')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb990319d90>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9902abf10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9902abf10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb9902abf10>
Out[19]:
(0.0, 306.8123238053698)
Out[19]:
Text(0.5, 0, ' Interest Coverage Ratio (Interest expense to EBIT)')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb990064c10>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb98feba850>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb98feba850>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb98feba850>
Out[19]:
(0.0, 52.49999999999996)
Out[19]:
Text(0.5, 0, ' Net Income Flag')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb98fcfc950>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb98fcf4410>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb98fcf4410>
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb98fcf4410>
Out[19]:
(0.0, 39.36327603696296)
Out[19]:
Text(0.5, 0, ' Equity to Liability')
Out[19]:
Text(0, 0.5, 'Bankrupt?')
Out[19]:
<matplotlib.legend.Legend at 0x7fb98fd6bc50>

Figure 7: Distribution plot after log1p transformation and max-min scaling

In [20]:
X = df_norm.drop(['Bankrupt?'], axis=1)
y = df_norm[['Bankrupt?']]
print(X.shape)
print(y.shape)
(6819, 95)
(6819, 1)

Figure 8: Split the training set into an 80% training and 20% validation set

In [21]:
# First split the data set into an 90% raw and 10% test set
X_raw,X_test,y_raw,y_test  = train_test_split(X, y,test_size=0.1,stratify = y, random_state = 321)
# Second pplit the raw data set into an 80% training and 20% validation set
X_train,X_val,y_train,y_val  = train_test_split(X_raw,y_raw,test_size=0.2,stratify = y_raw,random_state = 321)
In [22]:
# See if both the train, validation and test label distribution are similarly distributed
print(X_train.shape, y_train.shape,X_val.shape, y_val.shape, X_test.shape, y_test.shape)
print('Train dataset Bankrupt:', round(y_train.value_counts()[1] / len(y_train) * 100,2) ,'%')
print('Train dataset Not Bankrupt:', round(y_train.value_counts()[0] / len(y_train) * 100,2) ,'%')
print('Validation dataset Bankrupt:', round(y_val.value_counts()[1] / len(y_val) * 100,2) ,'%')
print('Validation dataset Not Bankrupt:', round(y_val.value_counts()[0] / len(y_val) * 100,2) ,'%')
print('Test dataset Bankrupt:', round(y_test.value_counts()[1] / len(y_test) * 100,2) ,'%')
print('Test dataset Not Bankrupt:', round(y_test.value_counts()[0] / len(y_test) * 100,2) ,'%')
(4909, 95) (4909, 1) (1228, 95) (1228, 1) (682, 95) (682, 1)
Train dataset Bankrupt: Bankrupt?
1            3.22
dtype: float64 %
Train dataset Not Bankrupt: Bankrupt?
0            96.78
dtype: float64 %
Validation dataset Bankrupt: Bankrupt?
1            3.26
dtype: float64 %
Validation dataset Not Bankrupt: Bankrupt?
0            96.74
dtype: float64 %
Test dataset Bankrupt: Bankrupt?
1            3.23
dtype: float64 %
Test dataset Not Bankrupt: Bankrupt?
0            96.77
dtype: float64 %

Figure 9: Imbalance the training dataset

In [23]:
print("Before OverSampling, counts of label '1': {}".format(sum(y_train.values==1)))
print("Before OverSampling, counts of label '0': {} \n".format(sum(y_train.values==0)))

smote = SMOTE(random_state=2)
X_train_oversampled, y_train_oversampled = smote.fit_sample(X_train, y_train)
X_train_oversampled = pd.DataFrame(X_train_oversampled, columns=X_train.columns)
y_train_oversampled = pd.DataFrame(y_train_oversampled, columns=y_train.columns)

print('After OverSampling, the shape of train_X: {}'.format(X_train_oversampled.shape))
print('After OverSampling, the shape of train_y: {} \n'.format(y_train_oversampled.shape))

print("After OverSampling, counts of label '1': {}".format(sum(y_train_oversampled.values==1)))
print("After OverSampling, counts of label '0': {}".format(sum(y_train_oversampled.values==0)))
Before OverSampling, counts of label '1': [158]
Before OverSampling, counts of label '0': [4751] 

After OverSampling, the shape of train_X: (9502, 95)
After OverSampling, the shape of train_y: (9502, 1) 

After OverSampling, counts of label '1': [4751]
After OverSampling, counts of label '0': [4751]
In [24]:
X_train_oversampled.head()
Out[24]:
ROA(C) before interest and depreciation before interest ROA(A) before interest and % after tax ROA(B) before interest and depreciation after tax Operating Gross Margin Realized Sales Gross Margin Operating Profit Rate Pre-tax net Interest Rate After-tax net Interest Rate Non-industry income and expenditure/revenue Continuous interest rate (after tax) Operating Expense Rate Research and development expense rate Cash flow rate Interest-bearing debt interest rate Tax rate (A) Net Value Per Share (B) Net Value Per Share (A) Net Value Per Share (C) Persistent EPS in the Last Four Seasons Cash Flow Per Share Revenue Per Share (Yuan ¥) Operating Profit Per Share (Yuan ¥) Per Share Net profit before tax (Yuan ¥) Realized Sales Gross Profit Growth Rate Operating Profit Growth Rate After-tax Net Profit Growth Rate Regular Net Profit Growth Rate Continuous Net Profit Growth Rate Total Asset Growth Rate Net Value Growth Rate Total Asset Return Growth Rate Ratio Cash Reinvestment % Current Ratio Quick Ratio Interest Expense Ratio Total debt/Total net worth Debt ratio % Net worth/Assets Long-term fund suitability ratio (A) Borrowing dependency ... Current Assets/Total Assets Cash/Total Assets Quick Assets/Current Liability Cash/Current Liability Current Liability to Assets Operating Funds to Liability Inventory/Working Capital Inventory/Current Liability Current Liabilities/Liability Working Capital/Equity Current Liabilities/Equity Long-term Liability to Current Assets Retained Earnings to Total Assets Total income/Total expense Total expense/Assets Current Asset Turnover Rate Quick Asset Turnover Rate Working capitcal Turnover Rate Cash Turnover Rate Cash Flow to Sales Fixed Assets to Assets Current Liability to Liability Current Liability to Equity Equity to Long-term Liability Cash Flow to Total Assets Cash Flow to Liability CFO to Assets Cash Flow to Equity Current Liability to Current Assets Liability-Assets Flag Net Income to Total Assets Total assets to GNP price No-credit Interval Gross Profit to Sales Net Income to Stockholder's Equity Liability to Equity Degree of Financial Leverage (DFL) Interest Coverage Ratio (Interest expense to EBIT) Net Income Flag Equity to Liability
0 0.547409 0.605266 0.587772 0.638342 0.638342 0.999333 0.797812 0.809626 0.303501 0.781909 0.000015 0.000006 0.470572 0.002528 0.215204 0.170157 0.170157 0.170157 0.221991 0.319976 0.000224 0.103656 0.184605 0.070109 0.848773 0.691183 0.691183 0.217799 0.000107 0.001300 0.284524 0.379317 0.001946 0.001624 0.630629 0.000019 0.013393 0.986607 0.015189 0.369637 ... 0.396543 0.332589 0.001632 0.004126 0.017297 0.367543 0.277046 0.000586 0.974717 0.736028 0.326655 0.000000 0.937372 0.002435 0.018749 0.000016 0.000015 0.594146 0.000036 0.671867 0.001116 0.974717 0.326655 0.110933 0.794024 0.681810 0.579592 0.329397 0.006680 0.0 0.818469 0.000018 0.624231 0.638339 0.841139 0.275095 0.026795 0.565178 1.0 0.243934
1 0.336275 0.373419 0.376144 0.561344 0.561344 0.997231 0.794793 0.806872 0.302623 0.778838 0.000053 0.000012 0.444455 0.000021 0.000000 0.155156 0.155156 0.155156 0.185875 0.301195 0.000108 0.076215 0.145364 0.022092 0.847945 0.688904 0.688904 0.217537 0.994688 0.000020 0.262708 0.324951 0.000381 0.000203 0.630520 0.000224 0.106660 0.893340 0.005182 0.373346 ... 0.501190 0.098550 0.000210 0.000201 0.112403 0.290149 0.277738 0.000406 0.993452 0.734402 0.330821 0.000000 0.893450 0.001897 0.042728 0.000044 0.000026 0.594108 0.000022 0.671238 0.014421 0.993452 0.330821 0.110933 0.559698 0.439607 0.388241 0.302413 0.034919 0.0 0.712651 0.000013 0.623630 0.561344 0.833997 0.278522 0.026763 0.565022 1.0 0.035437
2 0.499001 0.563127 0.555008 0.601284 0.601284 0.998999 0.797416 0.809346 0.303509 0.781605 0.997124 0.965115 0.458975 0.000037 0.000000 0.176647 0.176647 0.176647 0.221707 0.316545 0.001788 0.102272 0.175115 0.022152 0.848354 0.689569 0.689569 0.217609 0.982194 0.000020 0.264155 0.374222 0.001840 0.000832 0.630783 0.000060 0.038909 0.961091 0.009100 0.370011 ... 0.917684 0.199298 0.001009 0.001056 0.042638 0.333611 0.277227 0.001925 0.972665 0.742170 0.327476 0.000000 0.939245 0.002321 0.033923 0.000005 0.986806 0.593996 0.989098 0.671576 0.002391 0.972665 0.327476 0.110933 0.653741 0.465825 0.554952 0.315732 0.007090 0.0 0.814027 0.000032 0.624191 0.601283 0.841009 0.275787 0.026855 0.565445 1.0 0.097761
3 0.488324 0.546010 0.533969 0.602300 0.602524 0.999031 0.797424 0.809333 0.303456 0.781596 0.991106 0.944330 0.463045 0.000026 0.378682 0.175214 0.175214 0.175214 0.218115 0.319622 0.001199 0.103819 0.174136 0.022142 0.848104 0.689259 0.689259 0.217579 0.979908 0.000020 0.263822 0.380099 0.000470 0.000353 0.632192 0.000233 0.109653 0.890347 0.005700 0.374124 ... 0.522910 0.043850 0.000371 0.000106 0.095489 0.344746 0.277191 0.000210 0.819606 0.735824 0.330186 0.000151 0.935046 0.002284 0.018812 0.000006 0.000006 0.593960 0.753656 0.671580 0.007926 0.819606 0.330186 0.113667 0.655496 0.462166 0.579249 0.316430 0.028414 0.0 0.801860 0.000058 0.624068 0.602297 0.840476 0.278688 0.027258 0.566701 1.0 0.034392
4 0.410179 0.457861 0.451470 0.585725 0.585725 0.998728 0.797022 0.808971 0.303385 0.781204 0.000005 0.000000 0.461827 0.000028 0.000000 0.153344 0.153344 0.153344 0.177271 0.318773 0.001051 0.070108 0.139941 0.021762 0.848004 0.689288 0.689288 0.217580 0.967252 0.000015 0.263632 0.377473 0.000165 0.000056 0.630043 0.000972 0.211446 0.788554 0.005005 0.386486 ... 0.351526 0.008139 0.000054 0.000011 0.176007 0.341708 0.276441 0.000279 0.795916 0.723439 0.342277 0.975635 0.908281 0.001888 0.027222 0.000006 0.967302 0.593852 0.895036 0.671566 0.010963 0.795916 0.342277 0.110996 0.635281 0.458345 0.571779 0.312096 0.077750 0.0 0.741395 0.000170 0.622112 0.585726 0.831285 0.291196 0.026635 0.564287 1.0 0.016093

5 rows × 95 columns

In [121]:
def plot_confusion_matrix(cm, classes,
                          normalize=False,
                          title='Confusion matrix',
                          cmap=plt.cm.Blues):
    """
    This function prints and plots the confusion matrix.
    Normalization can be applied by setting `normalize=True`.
    """
    plt.imshow(cm, interpolation='nearest', cmap=cmap)
    plt.title(title)
    plt.colorbar()
    tick_marks = np.arange(len(classes))
    plt.xticks(tick_marks, classes, rotation=0)
    plt.yticks(tick_marks, classes)

    if normalize:
        cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
        #print("Normalized confusion matrix")
    else:
        1#print('Confusion matrix, without normalization')

    #print(cm)

    thresh = cm.max() / 2.
    for i, j in itertools.product(range(cm.shape[0]), range(cm.shape[1])):
        plt.text(j, i, cm[i, j],
                 horizontalalignment="center",
                 color="white" if cm[i, j] > thresh else "black")

    plt.tight_layout()
    plt.ylabel('Actual')
    plt.xlabel('Predicted')

def model_results(notes,logreg, select_feature,X_train, y_train, X_val, y_val,display_OLS='Y'):
  #print(notes)
  #logreg = LogisticRegression()
  model = logreg.fit(X_train[select_feature], y_train)
  y_pred = logreg.predict(X_val[select_feature])
  y_pred_proba = logreg.predict_proba(X_val[select_feature])[:, 1]
  [fpr, tpr, thr] = roc_curve(y_val, y_pred_proba)

  print("#"*25,notes,"#"*25)
  print("Training Accuracy = {:.4f}".format(logreg.score(X_train[select_feature], y_train)))
  print("Validation Accuracy = {:.4f}".format(logreg.score(X_val[select_feature], y_val)))
  print("\nTraining ROC_AUC_score : %.4f" % (roc_auc_score(y_train, y_train)))
  print("Validation ROC_AUC_score : %.4f" % (roc_auc_score(y_val, y_pred)))
  print("\nTraining f1_score : %.6f" % (f1_score(y_train, y_train)))
  print("Validation f1_score : %.6f" % (f1_score(y_val, y_pred)))
  #Confusion Matrix
  print("-"*15,"confusion_matrix","-"*15)
  print(confusion_matrix(y_val, y_pred))
  print('\n\n')
  print("-"*15,"CLASSIFICATION REPORT","-"*15)
  print(classification_report(y_val, y_pred, digits=4))

  idx = np.min(np.where(tpr > 0.95)) # index of the first threshold for which the sensibility > 0.95

  plt.figure()
  plt.plot(fpr, tpr, color='coral', label='ROC curve (area = %0.4f)' % auc(fpr, tpr))
  plt.plot([0, 1], [0, 1], 'k--')
  plt.plot([0,fpr[idx]], [tpr[idx],tpr[idx]], 'k--', color='blue')
  plt.plot([fpr[idx],fpr[idx]], [0,tpr[idx]], 'k--', color='blue')
  plt.xlim([0.0, 1.0])
  plt.ylim([0.0, 1.05])
  plt.xlabel('False Positive Rate (1 - specificity)', fontsize=14)
  plt.ylabel('True Positive Rate (recall)', fontsize=14)
  plt.title('Receiver Operating Characteristic (ROC) Curve')
  plt.legend(loc="lower right")
  plt.show()

  print("\n\nUsing a threshold of %.4f " % thr[idx] + "guarantees a sensitivity of %.4f " % tpr[idx] +  
        "and a specificity of %.4f" % (1-fpr[idx]) + 
        ", i.e. a false positive rate of %.4f%%." % (np.array(fpr[idx])*100))
  print('\n\n')

  plt.figure()
  #precision-recall curve
  precision, recall, thresholds_pr = precision_recall_curve(y_val, y_pred_proba)
  avg_pre = average_precision_score(y_val, y_pred_proba)
  plt.plot(precision, recall, label = " average precision = {:0.4f}".format(avg_pre), lw = 3, alpha = 0.7)
  plt.xlabel('Precision', fontsize = 14)
  plt.ylabel('Recall', fontsize = 14)
  plt.title('Precision-Recall Curve', fontsize = 18)
  plt.legend(loc = 'best')
  #find default threshold
  close_default = np.argmin(np.abs(thresholds_pr - 0.5))
  plt.plot(precision[close_default], recall[close_default], 'o', markersize = 8)
  plt.show()
  
  print('\n\n')
  class_names = [0,1]
  plt.figure()
  plot_confusion_matrix(confusion_matrix(y_val, y_pred), classes=class_names, title='Confusion Matrix')
  plt.show()

  print('\n\n')
  if display_OLS == 'Y':
    logitmodel = sm.OLS(y_train, X_train[select_feature]).fit()
    print(logitmodel.summary()) 

Figure 10: Junk Model with one variable

In [26]:
select_feature = [' Net Income to Total Assets']
logreg = LogisticRegression()
model_results('Model 1: Junk Model',logreg=logreg,select_feature=select_feature,X_train=X_train_oversampled, y_train=y_train_oversampled, X_val=X_val, y_val=y_val,display_OLS='Y')
######################### Model 1: Junk Model #########################
Training Accuracy = 0.8167
Validation Accuracy = 0.8469

Training ROC_AUC_score : 1.0000
Validation ROC_AUC_score : 0.7397

Training f1_score : 1.000000
Validation f1_score : 0.210084
--------------- confusion_matrix ---------------
[[1015  173]
 [  15   25]]



--------------- CLASSIFICATION REPORT ---------------
              precision    recall  f1-score   support

           0     0.9854    0.8544    0.9152      1188
           1     0.1263    0.6250    0.2101        40

    accuracy                         0.8469      1228
   macro avg     0.5558    0.7397    0.5627      1228
weighted avg     0.9575    0.8469    0.8923      1228


Using a threshold of 0.3323 guarantees a sensitivity of 0.9750 and a specificity of 0.5741, i.e. a false positive rate of 42.5926%.







                                 OLS Regression Results                                
=======================================================================================
Dep. Variable:              Bankrupt?   R-squared (uncentered):                   0.454
Model:                            OLS   Adj. R-squared (uncentered):              0.454
Method:                 Least Squares   F-statistic:                              7912.
Date:                Sun, 17 Oct 2021   Prob (F-statistic):                        0.00
Time:                        15:16:24   Log-Likelihood:                         -7311.4
No. Observations:                9502   AIC:                                  1.462e+04
Df Residuals:                    9501   BIC:                                  1.463e+04
Df Model:                           1                                                  
Covariance Type:            nonrobust                                                  
===============================================================================================
                                  coef    std err          t      P>|t|      [0.025      0.975]
-----------------------------------------------------------------------------------------------
 Net Income to Total Assets     0.6123      0.007     88.948      0.000       0.599       0.626
==============================================================================
Omnibus:                    32984.477   Durbin-Watson:                   0.137
Prob(Omnibus):                  0.000   Jarque-Bera (JB):             1560.002
Skew:                           0.006   Prob(JB):                         0.00
Kurtosis:                       1.015   Cond. No.                         1.00
==============================================================================

Warnings:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
In [27]:
X_norm = pd.concat([X_train,y_train], axis=1)
print(X_norm.head())
X_norm_corr = pd.DataFrame(X_norm.corr()['Bankrupt?'].sort_values(ascending=False).reset_index()).rename(columns={'index': 'col', 'Bankrupt?': 'corr'})
print(X_norm_corr.loc[(X_norm_corr['corr']).abs()>.1])
select_feature =list(set(X_norm_corr.loc[(X_norm_corr['corr']).abs()>.1]['col'].values) - set(['Bankrupt?']))
print(select_feature)
       ROA(C) before interest and depreciation before interest  ...  Bankrupt?
2586                                                  0.547409  ...          0
712                                                   0.336275  ...          0
1659                                                  0.499001  ...          0
1743                                                  0.488324  ...          0
525                                                   0.410179  ...          1

[5 rows x 96 columns]
                                                         col      corr
0                                                  Bankrupt?  1.000000
1                                               Debt ratio %  0.256306
2                                       Borrowing dependency  0.207607
3                                Current Liability to Assets  0.203380
4                                        Liability to Equity  0.193240
5                              Equity to Long-term Liability  0.190400
6                                Current Liability to Equity  0.171222
7                                 Current Liabilities/Equity  0.171222
8                        Current Liability to Current Assets  0.168956
9                                       Total expense/Assets  0.168259
10                                    Cash/Current Liability  0.130276
11                                     Liability-Assets Flag  0.125758
12               Inventory and accounts receivable/Net value  0.104637
70                               Operating profit per person -0.100084
71                                         Cash/Total Assets -0.101147
72                                Total income/Total expense -0.109832
73                               Realized Sales Gross Margin -0.117797
74                                     Gross Profit to Sales -0.118549
75                                    Operating Gross Margin -0.118550
76                                              Tax rate (A) -0.120223
77                                             CFO to Assets -0.122292
78                                    Working Capital/Equity -0.160465
79                          Operating profit/Paid-in capital -0.160921
80                       Operating Profit Per Share (Yuan ¥) -0.161578
81                                   Net Value Per Share (C) -0.164460
82                                   Net Value Per Share (B) -0.164822
83                                   Net Value Per Share (A) -0.165002
84                           Working Capital to Total Assets -0.191248
85                        Net Income to Stockholder's Equity -0.201943
86                  Per Share Net profit before tax (Yuan ¥) -0.220682
87                     Net profit before tax/Paid-in capital -0.227805
88                   Persistent EPS in the Last Four Seasons -0.235000
89                         Retained Earnings to Total Assets -0.239636
90                                          Net worth/Assets -0.256306
91   ROA(C) before interest and depreciation before interest -0.268019
92         ROA(B) before interest and depreciation after tax -0.278840
93                    ROA(A) before interest and % after tax -0.293421
94                                Net Income to Total Assets -0.340244
[' Liability to Equity', ' Persistent EPS in the Last Four Seasons', " Net Income to Stockholder's Equity", ' Current Liability to Current Assets', ' Net Value Per Share (B)', ' Operating profit per person', ' Working Capital/Equity', ' ROA(C) before interest and depreciation before interest', ' Current Liability to Equity', ' Liability-Assets Flag', ' Tax rate (A)', ' Retained Earnings to Total Assets', ' Cash/Total Assets', ' Net profit before tax/Paid-in capital', ' Operating profit/Paid-in capital', ' Net Value Per Share (A)', ' Cash/Current Liability', ' Borrowing dependency', ' Total expense/Assets', ' Working Capital to Total Assets', ' Current Liability to Assets', ' Per Share Net profit before tax (Yuan ¥)', ' Gross Profit to Sales', ' ROA(B) before interest and depreciation after tax', ' Current Liabilities/Equity', ' ROA(A) before interest and % after tax', ' Net worth/Assets', ' Inventory and accounts receivable/Net value', ' Equity to Long-term Liability', ' CFO to Assets', ' Realized Sales Gross Margin', ' Operating Profit Per Share (Yuan ¥)', ' Total income/Total expense', ' Net Value Per Share (C)', ' Net Income to Total Assets', ' Debt ratio %', ' Operating Gross Margin']
In [28]:
from statsmodels.stats.outliers_influence import variance_inflation_factor    

def calculate_vif_(X, thresh=100):
  cols = X.columns
  variables = np.arange(X.shape[1])
  dropped=True
  while dropped:
      dropped=False
      c = X[cols[variables]].values
      vif = [variance_inflation_factor(c, ix) for ix in np.arange(c.shape[1])]

      maxloc = vif.index(max(vif))
      if max(vif) > thresh:
          print('dropping \'' + X[cols[variables]].columns[maxloc] + '\' at index: ' + str(maxloc))
          variables = np.delete(variables, maxloc)
          dropped=True

  print('Remaining variables:')
  print(X.columns[variables])
  return X[cols[variables]]
In [29]:
X_train2 = X_train[select_feature]
calculate_vif_(X_train2, thresh=100)
dropping ' Current Liability to Equity' at index: 8
dropping ' Operating Gross Margin' at index: 35
dropping ' Net worth/Assets' at index: 25
dropping ' Realized Sales Gross Margin' at index: 28
dropping ' Liability to Equity' at index: 0
dropping ' Net Value Per Share (A)' at index: 13
dropping ' Working Capital/Equity' at index: 5
dropping ' Net Value Per Share (C)' at index: 27
dropping ' Net Income to Total Assets' at index: 27
dropping ' ROA(B) before interest and depreciation after tax' at index: 19
dropping ' Borrowing dependency' at index: 13
dropping ' Operating profit/Paid-in capital' at index: 11
dropping ' Retained Earnings to Total Assets' at index: 8
dropping ' Inventory and accounts receivable/Net value' at index: 18
dropping ' Gross Profit to Sales' at index: 15
dropping ' Persistent EPS in the Last Four Seasons' at index: 0
dropping ' Net Income to Stockholder's Equity' at index: 0
dropping ' ROA(A) before interest and % after tax' at index: 14
dropping ' Net profit before tax/Paid-in capital' at index: 7
dropping ' Current Liabilities/Equity' at index: 12
dropping ' ROA(C) before interest and depreciation before interest' at index: 3
dropping ' Per Share Net profit before tax (Yuan ¥)' at index: 10
dropping ' Working Capital to Total Assets' at index: 8
dropping ' Operating profit per person' at index: 2
Remaining variables:
Index([' Current Liability to Current Assets', ' Net Value Per Share (B)',
       ' Liability-Assets Flag', ' Tax rate (A)', ' Cash/Total Assets',
       ' Cash/Current Liability', ' Total expense/Assets',
       ' Current Liability to Assets', ' Equity to Long-term Liability',
       ' CFO to Assets', ' Operating Profit Per Share (Yuan ¥)',
       ' Total income/Total expense', ' Debt ratio %'],
      dtype='object')
Out[29]:
Current Liability to Current Assets Net Value Per Share (B) Liability-Assets Flag Tax rate (A) Cash/Total Assets Cash/Current Liability Total expense/Assets Current Liability to Assets Equity to Long-term Liability CFO to Assets Operating Profit Per Share (Yuan ¥) Total income/Total expense Debt ratio %
2586 0.006680 0.170157 0 0.215204 0.332589 0.004126 0.018749 0.017297 0.110933 0.579592 0.103656 0.002435 0.013393
712 0.034919 0.155156 0 0.000000 0.098550 0.000201 0.042728 0.112403 0.110933 0.388241 0.076215 0.001897 0.106660
1659 0.007090 0.176647 0 0.000000 0.199298 0.001056 0.033923 0.042638 0.110933 0.554952 0.102272 0.002321 0.038909
1743 0.028414 0.175214 0 0.378682 0.043850 0.000106 0.018812 0.095489 0.113667 0.579249 0.103819 0.002284 0.109653
525 0.077750 0.153344 0 0.000000 0.008139 0.000011 0.027222 0.176007 0.110996 0.571779 0.070108 0.001888 0.211446
... ... ... ... ... ... ... ... ... ... ... ... ... ...
2928 0.039568 0.176309 0 0.354287 0.043465 0.000103 0.012927 0.097149 0.115327 0.589101 0.098933 0.002281 0.118118
3191 0.011702 0.181703 0 0.040895 0.082237 0.000692 0.008417 0.026782 0.118991 0.658667 0.108623 0.002751 0.081114
1145 0.038931 0.175762 0 0.166616 0.095527 0.000111 0.009333 0.197559 0.115628 0.507085 0.104226 0.002450 0.204402
991 0.018030 0.205006 0 0.170867 0.143946 0.000809 0.026129 0.040322 0.110933 0.627511 0.110822 0.002600 0.050367
2969 0.044944 0.192617 0 0.015791 0.061888 0.000214 0.014557 0.066207 0.115705 0.588913 0.097142 0.002426 0.124014

4909 rows × 13 columns

In [30]:
select_feature =[' Cash/Total Assets', ' Equity to Long-term Liability',
       ' Current Liability to Assets', ' Tax rate (A)',
       ' Total expense/Assets', 
       ' Liability-Assets Flag', ' Net Value Per Share (B)', ' CFO to Assets',
       ' Cash/Current Liability', 
       ' Operating Profit Per Share (Yuan ¥)',
       ' Current Liability to Current Assets',' Net Income to Total Assets']
select_feature2=[' ROA(B) before interest and depreciation after tax', ' CFO to Assets',
       ' Cash Flow to Total Assets',
       ' Interest Coverage Ratio (Interest expense to EBIT)',
       ' Current Liability to Current Assets',
       ' Equity to Long-term Liability', ' Debt ratio %',
       ' Working Capital to Total Assets', ' Cash/Current Liability']
In [31]:
# check collinearity
plt.subplots(figsize=(38, 38))
sns.heatmap(X_norm[select_feature].corr(), annot =True, vmin=-1, vmax=1, center= 0, cmap= 'coolwarm', fmt='.1g')
Out[31]:
(<Figure size 2736x2736 with 1 Axes>,
 <matplotlib.axes._subplots.AxesSubplot at 0x7fb990e6e550>)
Out[31]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb990e6e550>
In [32]:
logreg = LogisticRegression()
model_results('Model 2: Hand-picked Model',logreg=logreg,select_feature=select_feature2,X_train=X_train_oversampled, y_train=y_train_oversampled, X_val=X_val, y_val=y_val,display_OLS='Y')
######################### Model 2: Hand-picked Model #########################
Training Accuracy = 0.8949
Validation Accuracy = 0.8575

Training ROC_AUC_score : 1.0000
Validation ROC_AUC_score : 0.8660

Training f1_score : 1.000000
Validation f1_score : 0.285714
--------------- confusion_matrix ---------------
[[1018  170]
 [   5   35]]



--------------- CLASSIFICATION REPORT ---------------
              precision    recall  f1-score   support

           0     0.9951    0.8569    0.9209      1188
           1     0.1707    0.8750    0.2857        40

    accuracy                         0.8575      1228
   macro avg     0.5829    0.8660    0.6033      1228
weighted avg     0.9683    0.8575    0.9002      1228


Using a threshold of 0.1407 guarantees a sensitivity of 0.9750 and a specificity of 0.5135, i.e. a false positive rate of 48.6532%.







                                 OLS Regression Results                                
=======================================================================================
Dep. Variable:              Bankrupt?   R-squared (uncentered):                   0.763
Model:                            OLS   Adj. R-squared (uncentered):              0.763
Method:                 Least Squares   F-statistic:                              3394.
Date:                Sun, 17 Oct 2021   Prob (F-statistic):                        0.00
Time:                        15:16:38   Log-Likelihood:                         -3351.3
No. Observations:                9502   AIC:                                      6721.
Df Residuals:                    9493   BIC:                                      6785.
Df Model:                           9                                                  
Covariance Type:            nonrobust                                                  
=======================================================================================================================
                                                          coef    std err          t      P>|t|      [0.025      0.975]
-----------------------------------------------------------------------------------------------------------------------
 ROA(B) before interest and depreciation after tax     -2.3107      0.060    -38.806      0.000      -2.427      -2.194
 CFO to Assets                                          0.1139      0.077      1.477      0.140      -0.037       0.265
 Cash Flow to Total Assets                             -0.1916      0.097     -1.978      0.048      -0.381      -0.002
 Interest Coverage Ratio (Interest expense to EBIT)     2.6014      0.161     16.189      0.000       2.286       2.916
 Current Liability to Current Assets                    0.6197      0.138      4.496      0.000       0.350       0.890
 Equity to Long-term Liability                         -0.3522      0.074     -4.743      0.000      -0.498      -0.207
 Debt ratio %                                           3.4920      0.085     40.892      0.000       3.325       3.659
 Working Capital to Total Assets                       -0.3136      0.091     -3.433      0.001      -0.493      -0.135
 Cash/Current Liability                                 0.2096      0.023      9.288      0.000       0.165       0.254
==============================================================================
Omnibus:                      838.459   Durbin-Watson:                   1.114
Prob(Omnibus):                  0.000   Jarque-Bera (JB):             2344.136
Skew:                          -0.488   Prob(JB):                         0.00
Kurtosis:                       5.229   Cond. No.                         79.6
==============================================================================

Warnings:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
In [34]:
#parameters = {'C': np.linspace(1, 1000, 1000)}
parameters = {"penalty": ['l2','l1','elasticnet'],'C': np.linspace(1, 1000, 1000),}
logreg = LogisticRegression()
#clf = GridSearchCV(logreg, parameters, cv=5, verbose=5, n_jobs=3)
   
rand_logreg = RandomizedSearchCV(logreg, parameters, n_iter=4,scoring='f1')
rand_logreg.fit(X_train_oversampled[select_feature], y_train_oversampled)

print(" Results from Random Search " )
print("\n The best estimator across ALL searched params:\n", rand_logreg.best_estimator_)
print("\n The best score across ALL searched params:\n", rand_logreg.best_score_)
print("\n The best parameters across ALL searched params:\n", rand_logreg.best_params_)
Out[34]:
RandomizedSearchCV(cv=None, error_score=nan,
                   estimator=LogisticRegression(C=1.0, class_weight=None,
                                                dual=False, fit_intercept=True,
                                                intercept_scaling=1,
                                                l1_ratio=None, max_iter=100,
                                                multi_class='auto', n_jobs=None,
                                                penalty='l2', random_state=None,
                                                solver='lbfgs', tol=0.0001,
                                                verbose=0, warm_start=False),
                   iid='deprecated', n_iter=4, n_jobs=None,
                   param_distributions={'C...
        955.,  956.,  957.,  958.,  959.,  960.,  961.,  962.,  963.,
        964.,  965.,  966.,  967.,  968.,  969.,  970.,  971.,  972.,
        973.,  974.,  975.,  976.,  977.,  978.,  979.,  980.,  981.,
        982.,  983.,  984.,  985.,  986.,  987.,  988.,  989.,  990.,
        991.,  992.,  993.,  994.,  995.,  996.,  997.,  998.,  999.,
       1000.]),
                                        'penalty': ['l2', 'l1', 'elasticnet']},
                   pre_dispatch='2*n_jobs', random_state=None, refit=True,
                   return_train_score=False, scoring='f1', verbose=0)
 Results from Random Search 

 The best estimator across ALL searched params:
 LogisticRegression(C=839.0, class_weight=None, dual=False, fit_intercept=True,
                   intercept_scaling=1, l1_ratio=None, max_iter=100,
                   multi_class='auto', n_jobs=None, penalty='l2',
                   random_state=None, solver='lbfgs', tol=0.0001, verbose=0,
                   warm_start=False)

 The best score across ALL searched params:
 0.9045353037359039

 The best parameters across ALL searched params:
 {'penalty': 'l2', 'C': 839.0}

Figure 11: Logistic regression model

In [36]:
logreg1 = LogisticRegression(C=503.0, class_weight=None, dual=False, fit_intercept=True,
                   intercept_scaling=1, l1_ratio=None, max_iter=100,
                   multi_class='auto', n_jobs=None, penalty='l2',
                   random_state=None, solver='lbfgs', tol=0.0001, verbose=0,
                   warm_start=False)
model_results('Model 2: Hand-picked Model',logreg=logreg1,select_feature=select_feature,X_train=X_train_oversampled, y_train=y_train_oversampled, X_val=X_val, y_val=y_val,display_OLS='Y')
######################### Model 2: Hand-picked Model #########################
Training Accuracy = 0.9037
Validation Accuracy = 0.8770

Training ROC_AUC_score : 1.0000
Validation ROC_AUC_score : 0.8761

Training f1_score : 1.000000
Validation f1_score : 0.316742
--------------- confusion_matrix ---------------
[[1042  146]
 [   5   35]]



--------------- CLASSIFICATION REPORT ---------------
              precision    recall  f1-score   support

           0     0.9952    0.8771    0.9324      1188
           1     0.1934    0.8750    0.3167        40

    accuracy                         0.8770      1228
   macro avg     0.5943    0.8761    0.6246      1228
weighted avg     0.9691    0.8770    0.9124      1228


Using a threshold of 0.0891 guarantees a sensitivity of 0.9750 and a specificity of 0.5901, i.e. a false positive rate of 40.9933%.







                                 OLS Regression Results                                
=======================================================================================
Dep. Variable:              Bankrupt?   R-squared (uncentered):                   0.726
Model:                            OLS   Adj. R-squared (uncentered):              0.725
Method:                 Least Squares   F-statistic:                              2092.
Date:                Sun, 17 Oct 2021   Prob (F-statistic):                        0.00
Time:                        15:19:26   Log-Likelihood:                         -4044.6
No. Observations:                9502   AIC:                                      8113.
Df Residuals:                    9490   BIC:                                      8199.
Df Model:                          12                                                  
Covariance Type:            nonrobust                                                  
========================================================================================================
                                           coef    std err          t      P>|t|      [0.025      0.975]
--------------------------------------------------------------------------------------------------------
 Cash/Total Assets                      -0.6292      0.039    -16.184      0.000      -0.705      -0.553
 Equity to Long-term Liability           0.3120      0.080      3.901      0.000       0.155       0.469
 Current Liability to Assets             2.9323      0.080     36.562      0.000       2.775       3.090
 Tax rate (A)                           -0.8876      0.035    -25.496      0.000      -0.956      -0.819
 Total expense/Assets                    1.9379      0.128     15.154      0.000       1.687       2.189
 Liability-Assets Flag                  -0.3746      0.062     -6.043      0.000      -0.496      -0.253
 Net Value Per Share (B)                -0.5292      0.183     -2.893      0.004      -0.888      -0.171
 CFO to Assets                           0.2950      0.076      3.889      0.000       0.146       0.444
 Cash/Current Liability                  0.1700      0.025      6.923      0.000       0.122       0.218
 Operating Profit Per Share (Yuan ¥)    -3.6335      0.240    -15.156      0.000      -4.103      -3.164
 Current Liability to Current Assets     1.5793      0.119     13.290      0.000       1.346       1.812
 Net Income to Total Assets              0.4636      0.067      6.878      0.000       0.332       0.596
==============================================================================
Omnibus:                      178.380   Durbin-Watson:                   1.006
Prob(Omnibus):                  0.000   Jarque-Bera (JB):              253.542
Skew:                          -0.222   Prob(JB):                     8.79e-56
Kurtosis:                       3.666   Cond. No.                         69.5
==============================================================================

Warnings:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
In [37]:
gnb_sm = GaussianNB()
gnb_params = {'var_smoothing': np.logspace(0,-2, num=1000)}
    
rand_gnb = RandomizedSearchCV(gnb_sm, gnb_params, n_iter=4,scoring='f1')
rand_gnb.fit(X_train_oversampled[select_feature2], y_train_oversampled)

print(" Results from Random Search " )
print("\n The best estimator across ALL searched params:\n", rand_gnb.best_estimator_)
print("\n The best score across ALL searched params:\n", rand_gnb.best_score_)
print("\n The best parameters across ALL searched params:\n", rand_gnb.best_params_)
Out[37]:
RandomizedSearchCV(cv=None, error_score=nan,
                   estimator=GaussianNB(priors=None, var_smoothing=1e-09),
                   iid='deprecated', n_iter=4, n_jobs=None,
                   param_distributions={'var_smoothing': array([1.        , 0.99540083, 0.99082281, 0.98626585, 0.98172984,
       0.9772147 , 0.97272032, 0.96824661, 0.96379348, 0.95936083,
       0.95494856, 0.95055659, 0.94618482, 0.94183315, 0.9375015 ,
       0.93318977, 0.928...
       0.01116987, 0.0111185 , 0.01106736, 0.01101646, 0.01096579,
       0.01091536, 0.01086516, 0.01081519, 0.01076545, 0.01071593,
       0.01066665, 0.01061759, 0.01056876, 0.01052015, 0.01047177,
       0.01042361, 0.01037567, 0.01032795, 0.01028045, 0.01023317,
       0.0101861 , 0.01013925, 0.01009262, 0.0100462 , 0.01      ])},
                   pre_dispatch='2*n_jobs', random_state=None, refit=True,
                   return_train_score=False, scoring='f1', verbose=0)
 Results from Random Search 

 The best estimator across ALL searched params:
 GaussianNB(priors=None, var_smoothing=0.016758078645307678)

 The best score across ALL searched params:
 0.7815589351178921

 The best parameters across ALL searched params:
 {'var_smoothing': 0.016758078645307678}

Figure 12: Naïve Bayes model

In [38]:
gaussian_nb =  GaussianNB(priors=None,var_smoothing=0.05817880074344935)
model_results('Model 3: GaussianNB Model',logreg=gaussian_nb,select_feature=select_feature2,X_train=X_train_oversampled, y_train=y_train_oversampled, X_val=X_val, y_val=y_val,display_OLS='N')
######################### Model 3: GaussianNB Model #########################
Training Accuracy = 0.8033
Validation Accuracy = 0.9332

Training ROC_AUC_score : 1.0000
Validation ROC_AUC_score : 0.7481

Training f1_score : 1.000000
Validation f1_score : 0.349206
--------------- confusion_matrix ---------------
[[1124   64]
 [  18   22]]



--------------- CLASSIFICATION REPORT ---------------
              precision    recall  f1-score   support

           0     0.9842    0.9461    0.9648      1188
           1     0.2558    0.5500    0.3492        40

    accuracy                         0.9332      1228
   macro avg     0.6200    0.7481    0.6570      1228
weighted avg     0.9605    0.9332    0.9448      1228


Using a threshold of 0.0219 guarantees a sensitivity of 0.9750 and a specificity of 0.5370, i.e. a false positive rate of 46.2963%.







In [40]:
# Grid Search
# Parameter Grid
param_grid = {'C': [0.1,1, 10, 100], 'gamma': [1,0.1,0.01,0.001],'kernel': ['rbf', 'poly', 'sigmoid','linear']}
# Make grid search classifier
#clf_grid = GridSearchCV(svm.SVC(), param_grid,refit=True,verbose=2)
rand_svc = RandomizedSearchCV(svm.SVC(), param_grid, n_iter=4,scoring='f1')

rand_svc.fit(X_train_oversampled[select_feature], y_train_oversampled)

print(" Results from Random Search " )
print("\n The best estimator across ALL searched params:\n", rand_svc.best_estimator_)
print("\n The best score across ALL searched params:\n", rand_svc.best_score_)
print("\n The best parameters across ALL searched params:\n", rand_svc.best_params_)
Out[40]:
RandomizedSearchCV(cv=None, error_score=nan,
                   estimator=SVC(C=1.0, break_ties=False, cache_size=200,
                                 class_weight=None, coef0=0.0,
                                 decision_function_shape='ovr', degree=3,
                                 gamma='scale', kernel='rbf', max_iter=-1,
                                 probability=False, random_state=None,
                                 shrinking=True, tol=0.001, verbose=False),
                   iid='deprecated', n_iter=4, n_jobs=None,
                   param_distributions={'C': [0.1, 1, 10, 100],
                                        'gamma': [1, 0.1, 0.01, 0.001],
                                        'kernel': ['rbf', 'poly', 'sigmoid',
                                                   'linear']},
                   pre_dispatch='2*n_jobs', random_state=None, refit=True,
                   return_train_score=False, scoring='f1', verbose=0)
 Results from Random Search 

 The best estimator across ALL searched params:
 SVC(C=100, break_ties=False, cache_size=200, class_weight=None, coef0=0.0,
    decision_function_shape='ovr', degree=3, gamma=0.1, kernel='rbf',
    max_iter=-1, probability=False, random_state=None, shrinking=True,
    tol=0.001, verbose=False)

 The best score across ALL searched params:
 0.9033689775438727

 The best parameters across ALL searched params:
 {'kernel': 'rbf', 'gamma': 0.1, 'C': 100}

Figure 13: SVM model

In [41]:
model_svm= svm.SVC(C=10, break_ties=False, cache_size=200, class_weight=None, coef0=0.0,
    decision_function_shape='ovr', degree=3, gamma=1, kernel='rbf', max_iter=-1,
    probability=True, random_state=None, shrinking=True, tol=0.001,
    verbose=False)

model_results('Model 4: SVM Model',logreg=model_svm,select_feature=select_feature,X_train=X_train_oversampled, y_train=y_train_oversampled, X_val=X_val, y_val=y_val,display_OLS='N')
######################### Model 4: SVM Model #########################
Training Accuracy = 0.9060
Validation Accuracy = 0.8697

Training ROC_AUC_score : 1.0000
Validation ROC_AUC_score : 0.8360

Training f1_score : 1.000000
Validation f1_score : 0.285714
--------------- confusion_matrix ---------------
[[1036  152]
 [   8   32]]



--------------- CLASSIFICATION REPORT ---------------
              precision    recall  f1-score   support

           0     0.9923    0.8721    0.9283      1188
           1     0.1739    0.8000    0.2857        40

    accuracy                         0.8697      1228
   macro avg     0.5831    0.8360    0.6070      1228
weighted avg     0.9657    0.8697    0.9074      1228


Using a threshold of 0.0832 guarantees a sensitivity of 0.9750 and a specificity of 0.6254, i.e. a false positive rate of 37.4579%.







PCA

In [85]:
# Standardizing the features
npca = .99
#X_trainPCA = StandardScaler().fit_transform(X_train_oversampled)
pca = PCA(n_components=npca)
pca_train = pca.fit_transform(X_train_oversampled)#
pca_trainDF = pd.DataFrame(data = pca_train)

#X_valPCA = StandardScaler().fit_transform(X_val)
pca_val = pca.transform(X_val)
pca_valDF = pd.DataFrame(data = pca_val)

pca.explained_variance_ratio_
Out[85]:
array([0.23144593, 0.17057855, 0.11665279, 0.10132421, 0.09673275,
       0.07108871, 0.03807897, 0.03499814, 0.0310539 , 0.01861489,
       0.01609907, 0.01314788, 0.00950229, 0.00670183, 0.00592378,
       0.0052103 , 0.00472399, 0.00449041, 0.00383351, 0.00267553,
       0.00215841, 0.00161441, 0.00144902, 0.00114952, 0.00105797])
In [87]:
parameters = {"penalty": ['l2','l1','elasticnet'],'C': np.linspace(1, 1000, 1000),}
logregPCA = LogisticRegression().fit(pca_trainDF, y_train_oversampled)

rand_logregPCA = RandomizedSearchCV(logregPCA, parameters, n_iter=4,scoring='f1')
rand_logregPCA.fit(pca_trainDF, y_train_oversampled)

print(" Results from Random Search " )
print("\n The best estimator across ALL searched params:\n", rand_logregPCA.best_estimator_)
print("\n The best score across ALL searched params:\n", rand_logregPCA.best_score_)
print("\n The best parameters across ALL searched params:\n", rand_logregPCA.best_params_)
print(pca.explained_variance_ratio_)

select_featurePCA=pca_trainDF.columns
print(select_featurePCA)
Out[87]:
RandomizedSearchCV(cv=None, error_score=nan,
                   estimator=LogisticRegression(C=1.0, class_weight=None,
                                                dual=False, fit_intercept=True,
                                                intercept_scaling=1,
                                                l1_ratio=None, max_iter=100,
                                                multi_class='auto', n_jobs=None,
                                                penalty='l2', random_state=None,
                                                solver='lbfgs', tol=0.0001,
                                                verbose=0, warm_start=False),
                   iid='deprecated', n_iter=4, n_jobs=None,
                   param_distributions={'C...
        955.,  956.,  957.,  958.,  959.,  960.,  961.,  962.,  963.,
        964.,  965.,  966.,  967.,  968.,  969.,  970.,  971.,  972.,
        973.,  974.,  975.,  976.,  977.,  978.,  979.,  980.,  981.,
        982.,  983.,  984.,  985.,  986.,  987.,  988.,  989.,  990.,
        991.,  992.,  993.,  994.,  995.,  996.,  997.,  998.,  999.,
       1000.]),
                                        'penalty': ['l2', 'l1', 'elasticnet']},
                   pre_dispatch='2*n_jobs', random_state=None, refit=True,
                   return_train_score=False, scoring='f1', verbose=0)
 Results from Random Search 

 The best estimator across ALL searched params:
 LogisticRegression(C=944.0, class_weight=None, dual=False, fit_intercept=True,
                   intercept_scaling=1, l1_ratio=None, max_iter=100,
                   multi_class='auto', n_jobs=None, penalty='l2',
                   random_state=None, solver='lbfgs', tol=0.0001, verbose=0,
                   warm_start=False)

 The best score across ALL searched params:
 0.9081021946833239

 The best parameters across ALL searched params:
 {'penalty': 'l2', 'C': 944.0}
[0.23144593 0.17057855 0.11665279 0.10132421 0.09673275 0.07108871
 0.03807897 0.03499814 0.0310539  0.01861489 0.01609907 0.01314788
 0.00950229 0.00670183 0.00592378 0.0052103  0.00472399 0.00449041
 0.00383351 0.00267553 0.00215841 0.00161441 0.00144902 0.00114952
 0.00105797]
RangeIndex(start=0, stop=25, step=1)
In [88]:
logregPCA1 = LogisticRegression(C=944.0, class_weight=None, dual=False, fit_intercept=True,
                   intercept_scaling=1, l1_ratio=None, max_iter=100,
                   multi_class='auto', n_jobs=None, penalty='l2',
                   random_state=None, solver='lbfgs', tol=0.0001, verbose=0,
                   warm_start=False)
model_results('Model 2.1: Logistic PCA Model',logreg=logregPCA1,select_feature=select_featurePCA,X_train=pca_trainDF, y_train=y_train_oversampled, X_val=pca_valDF, y_val=y_val,display_OLS='Y')
######################### Model 2.1: Logistic PCA Model #########################
Training Accuracy = 0.9065
Validation Accuracy = 0.8754

Training ROC_AUC_score : 1.0000
Validation ROC_AUC_score : 0.8631

Training f1_score : 1.000000
Validation f1_score : 0.307692
--------------- confusion_matrix ---------------
[[1041  147]
 [   6   34]]



--------------- CLASSIFICATION REPORT ---------------
              precision    recall  f1-score   support

           0     0.9943    0.8763    0.9315      1188
           1     0.1878    0.8500    0.3077        40

    accuracy                         0.8754      1228
   macro avg     0.5911    0.8631    0.6196      1228
weighted avg     0.9680    0.8754    0.9112      1228


Using a threshold of 0.0612 guarantees a sensitivity of 0.9750 and a specificity of 0.5918, i.e. a false positive rate of 40.8249%.







                                 OLS Regression Results                                
=======================================================================================
Dep. Variable:              Bankrupt?   R-squared (uncentered):                   0.289
Model:                            OLS   Adj. R-squared (uncentered):              0.287
Method:                 Least Squares   F-statistic:                              154.1
Date:                Sun, 17 Oct 2021   Prob (F-statistic):                        0.00
Time:                        16:08:35   Log-Likelihood:                         -8568.9
No. Observations:                9502   AIC:                                  1.719e+04
Df Residuals:                    9477   BIC:                                  1.737e+04
Df Model:                          25                                                  
Covariance Type:            nonrobust                                                  
==============================================================================
                 coef    std err          t      P>|t|      [0.025      0.975]
------------------------------------------------------------------------------
0              0.0844      0.010      8.711      0.000       0.065       0.103
1              0.2729      0.011     24.192      0.000       0.251       0.295
2             -0.0062      0.014     -0.456      0.649      -0.033       0.021
3             -0.2015      0.015    -13.764      0.000      -0.230      -0.173
4              0.0374      0.015      2.494      0.013       0.008       0.067
5             -0.3412      0.017    -19.525      0.000      -0.375      -0.307
6              0.0215      0.024      0.900      0.368      -0.025       0.068
7             -0.4478      0.025    -17.980      0.000      -0.497      -0.399
8             -0.1214      0.026     -4.591      0.000      -0.173      -0.070
9              1.4309      0.034     41.905      0.000       1.364       1.498
10            -0.3433      0.037     -9.348      0.000      -0.415      -0.271
11             0.0206      0.041      0.508      0.612      -0.059       0.100
12             0.0037      0.048      0.078      0.938      -0.090       0.097
13            -0.1722      0.057     -3.025      0.002      -0.284      -0.061
14             0.1647      0.061      2.721      0.007       0.046       0.283
15            -0.3709      0.065     -5.746      0.000      -0.497      -0.244
16             0.4549      0.068      6.711      0.000       0.322       0.588
17            -0.0223      0.070     -0.320      0.749      -0.159       0.114
18             0.5263      0.075      6.995      0.000       0.379       0.674
19             0.2871      0.090      3.187      0.001       0.110       0.464
20            -1.1722      0.100    -11.689      0.000      -1.369      -0.976
21            -0.6546      0.116     -5.645      0.000      -0.882      -0.427
22             0.2435      0.122      1.990      0.047       0.004       0.483
23            -0.9770      0.137     -7.110      0.000      -1.246      -0.708
24             1.0028      0.143      7.001      0.000       0.722       1.284
==============================================================================
Omnibus:                      707.067   Durbin-Watson:                   0.361
Prob(Omnibus):                  0.000   Jarque-Bera (JB):             1383.234
Skew:                          -0.517   Prob(JB):                    4.31e-301
Kurtosis:                       4.557   Cond. No.                         14.8
==============================================================================

Warnings:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
In [101]:
gnb_sm = GaussianNB()
gnb_params = {'var_smoothing': np.logspace(0,-2, num=1000)}
    
rand_gnbPCA = RandomizedSearchCV(gnb_sm, gnb_params, n_iter=10,scoring='f1')
rand_gnbPCA.fit(pca_trainDF, y_train_oversampled)

print(" Results from Random Search " )
print("\n The best estimator across ALL searched params:\n", rand_gnbPCA.best_estimator_)
print("\n The best score across ALL searched params:\n", rand_gnbPCA.best_score_)
print("\n The best parameters across ALL searched params:\n", rand_gnbPCA.best_params_)
Out[101]:
RandomizedSearchCV(cv=None, error_score=nan,
                   estimator=GaussianNB(priors=None, var_smoothing=1e-09),
                   iid='deprecated', n_iter=10, n_jobs=None,
                   param_distributions={'var_smoothing': array([1.        , 0.99540083, 0.99082281, 0.98626585, 0.98172984,
       0.9772147 , 0.97272032, 0.96824661, 0.96379348, 0.95936083,
       0.95494856, 0.95055659, 0.94618482, 0.94183315, 0.9375015 ,
       0.93318977, 0.92...
       0.01116987, 0.0111185 , 0.01106736, 0.01101646, 0.01096579,
       0.01091536, 0.01086516, 0.01081519, 0.01076545, 0.01071593,
       0.01066665, 0.01061759, 0.01056876, 0.01052015, 0.01047177,
       0.01042361, 0.01037567, 0.01032795, 0.01028045, 0.01023317,
       0.0101861 , 0.01013925, 0.01009262, 0.0100462 , 0.01      ])},
                   pre_dispatch='2*n_jobs', random_state=None, refit=True,
                   return_train_score=False, scoring='f1', verbose=0)
 Results from Random Search 

 The best estimator across ALL searched params:
 GaussianNB(priors=None, var_smoothing=0.013369837418249465)

 The best score across ALL searched params:
 0.8279198848822548

 The best parameters across ALL searched params:
 {'var_smoothing': 0.013369837418249465}
In [102]:
gaussian_nbPCA =  GaussianNB(priors=None, var_smoothing=0.013369837418249465)
model_results('Model 3.1: GaussianNB Model',logreg=gaussian_nbPCA,select_feature=select_featurePCA,X_train=pca_trainDF, y_train=y_train_oversampled, X_val=pca_valDF, y_val=y_val,display_OLS='N')
######################### Model 3.1: GaussianNB Model #########################
Training Accuracy = 0.8077
Validation Accuracy = 0.6808

Training ROC_AUC_score : 1.0000
Validation ROC_AUC_score : 0.7384

Training f1_score : 1.000000
Validation f1_score : 0.140351
--------------- confusion_matrix ---------------
[[804 384]
 [  8  32]]



--------------- CLASSIFICATION REPORT ---------------
              precision    recall  f1-score   support

           0     0.9901    0.6768    0.8040      1188
           1     0.0769    0.8000    0.1404        40

    accuracy                         0.6808      1228
   macro avg     0.5335    0.7384    0.4722      1228
weighted avg     0.9604    0.6808    0.7824      1228


Using a threshold of 0.0538 guarantees a sensitivity of 0.9750 and a specificity of 0.2239, i.e. a false positive rate of 77.6094%.







In [92]:
# Grid Search
# Parameter Grid
param_grid = {'C': [0.1,1, 10, 100], 'gamma': [1,0.1,0.01,0.001],'kernel': ['rbf', 'poly', 'sigmoid','linear']}
# Make grid search classifier
#clf_grid = GridSearchCV(svm.SVC(), param_grid,refit=True,verbose=2)
rand_svcPCA = RandomizedSearchCV(svm.SVC(), param_grid, n_iter=4,scoring='f1')

rand_svcPCA.fit(pca_trainDF, y_train_oversampled)

print(" Results from Random Search " )
print("\n The best estimator across ALL searched params:\n", rand_svcPCA.best_estimator_)
print("\n The best score across ALL searched params:\n", rand_svcPCA.best_score_)
print("\n The best parameters across ALL searched params:\n", rand_svcPCA.best_params_)
Out[92]:
RandomizedSearchCV(cv=None, error_score=nan,
                   estimator=SVC(C=1.0, break_ties=False, cache_size=200,
                                 class_weight=None, coef0=0.0,
                                 decision_function_shape='ovr', degree=3,
                                 gamma='scale', kernel='rbf', max_iter=-1,
                                 probability=False, random_state=None,
                                 shrinking=True, tol=0.001, verbose=False),
                   iid='deprecated', n_iter=4, n_jobs=None,
                   param_distributions={'C': [0.1, 1, 10, 100],
                                        'gamma': [1, 0.1, 0.01, 0.001],
                                        'kernel': ['rbf', 'poly', 'sigmoid',
                                                   'linear']},
                   pre_dispatch='2*n_jobs', random_state=None, refit=True,
                   return_train_score=False, scoring='f1', verbose=0)
 Results from Random Search 

 The best estimator across ALL searched params:
 SVC(C=10, break_ties=False, cache_size=200, class_weight=None, coef0=0.0,
    decision_function_shape='ovr', degree=3, gamma=0.1, kernel='rbf',
    max_iter=-1, probability=False, random_state=None, shrinking=True,
    tol=0.001, verbose=False)

 The best score across ALL searched params:
 0.9513103262183529

 The best parameters across ALL searched params:
 {'kernel': 'rbf', 'gamma': 0.1, 'C': 10}
In [103]:
model_svmPCA= svm.SVC(C=10, break_ties=False, cache_size=200, class_weight=None, coef0=0.0,
    decision_function_shape='ovr', degree=3, gamma=0.1, kernel='rbf',
    max_iter=-1, probability=True, random_state=None, shrinking=True,
    tol=0.001, verbose=False)

model_results('Model 4.1: SVM Model',logreg=model_svmPCA,select_feature=select_featurePCA,X_train=pca_trainDF, y_train=y_train_oversampled, X_val=pca_valDF, y_val=y_val,display_OLS='N')
######################### Model 4.1: SVM Model #########################
Training Accuracy = 0.9558
Validation Accuracy = 0.9153

Training ROC_AUC_score : 1.0000
Validation ROC_AUC_score : 0.8234

Training f1_score : 1.000000
Validation f1_score : 0.358025
--------------- confusion_matrix ---------------
[[1095   93]
 [  11   29]]



--------------- CLASSIFICATION REPORT ---------------
              precision    recall  f1-score   support

           0     0.9901    0.9217    0.9547      1188
           1     0.2377    0.7250    0.3580        40

    accuracy                         0.9153      1228
   macro avg     0.6139    0.8234    0.6563      1228
weighted avg     0.9655    0.9153    0.9352      1228


Using a threshold of 0.0019 guarantees a sensitivity of 0.9750 and a specificity of 0.4672, i.e. a false positive rate of 53.2828%.







In [43]:
# Number of trees in random forest
n_estimators = [int(x) for x in np.linspace(start = 10, stop = 80, num = 10)]
# Number of features to consider at every split
max_features = ['auto', 'sqrt', 'log2']
# Maximum number of levels in tree
max_depth = [10,20,40,80]
# Minimum number of samples required to split a node
min_samples_split = [2, 5]
# Minimum number of samples required at each leaf node
min_samples_leaf = [1, 2]
# Method of selecting samples for training each tree
bootstrap = [True, False]
criterion=['entropy','gini']
class_weight= ['balanced','balanced_subsample']

# Create the param grid
param_grid = {'n_estimators': n_estimators,
               'max_features': max_features,
               'max_depth': max_depth,
               'min_samples_split': min_samples_split,
               'min_samples_leaf': min_samples_leaf,
               'bootstrap': bootstrap,
              'criterion':criterion,
              'class_weight' :class_weight}
print(param_grid)

model_rf = RandomForestClassifier()
rand_rf = RandomizedSearchCV(estimator = rf_Model, param_distributions = param_grid, cv = 10, verbose=2, n_jobs = 4,scoring='f1')
rand_rf.fit(X_train_oversampled, y_train_oversampled)

print(" Results from Random Search " )
print("\n The best estimator across ALL searched params:\n", rand_rf.best_estimator_)
print("\n The best score across ALL searched params:\n", rand_rf.best_score_)
print("\n The best parameters across ALL searched params:\n", rand_rf.best_params_)
{'n_estimators': [10, 17, 25, 33, 41, 48, 56, 64, 72, 80], 'max_features': ['auto', 'sqrt', 'log2'], 'max_depth': [10, 20, 40, 80], 'min_samples_split': [2, 5], 'min_samples_leaf': [1, 2], 'bootstrap': [True, False], 'criterion': ['entropy', 'gini'], 'class_weight': ['balanced', 'balanced_subsample']}
Fitting 10 folds for each of 10 candidates, totalling 100 fits
[Parallel(n_jobs=4)]: Using backend LokyBackend with 4 concurrent workers.
[Parallel(n_jobs=4)]: Done  33 tasks      | elapsed:  1.1min
[Parallel(n_jobs=4)]: Done 100 out of 100 | elapsed:  4.1min finished
Out[43]:
RandomizedSearchCV(cv=10, error_score=nan,
                   estimator=RandomForestClassifier(bootstrap=True,
                                                    ccp_alpha=0.0,
                                                    class_weight=None,
                                                    criterion='gini',
                                                    max_depth=None,
                                                    max_features='auto',
                                                    max_leaf_nodes=None,
                                                    max_samples=None,
                                                    min_impurity_decrease=0.0,
                                                    min_impurity_split=None,
                                                    min_samples_leaf=1,
                                                    min_samples_split=2,
                                                    min_weight_fraction_leaf=0.0,
                                                    n_estimators=100,
                                                    n_job...
                   param_distributions={'bootstrap': [True, False],
                                        'class_weight': ['balanced',
                                                         'balanced_subsample'],
                                        'criterion': ['entropy', 'gini'],
                                        'max_depth': [10, 20, 40, 80],
                                        'max_features': ['auto', 'sqrt',
                                                         'log2'],
                                        'min_samples_leaf': [1, 2],
                                        'min_samples_split': [2, 5],
                                        'n_estimators': [10, 17, 25, 33, 41, 48,
                                                         56, 64, 72, 80]},
                   pre_dispatch='2*n_jobs', random_state=None, refit=True,
                   return_train_score=False, scoring='f1', verbose=2)
 Results from Random Search 

 The best estimator across ALL searched params:
 RandomForestClassifier(bootstrap=False, ccp_alpha=0.0,
                       class_weight='balanced_subsample', criterion='entropy',
                       max_depth=40, max_features='sqrt', max_leaf_nodes=None,
                       max_samples=None, min_impurity_decrease=0.0,
                       min_impurity_split=None, min_samples_leaf=1,
                       min_samples_split=2, min_weight_fraction_leaf=0.0,
                       n_estimators=80, n_jobs=None, oob_score=False,
                       random_state=None, verbose=0, warm_start=False)

 The best score across ALL searched params:
 0.9857641585800634

 The best parameters across ALL searched params:
 {'n_estimators': 80, 'min_samples_split': 2, 'min_samples_leaf': 1, 'max_features': 'sqrt', 'max_depth': 40, 'criterion': 'entropy', 'class_weight': 'balanced_subsample', 'bootstrap': False}

Figure 14: Random Forest Classifier

In [44]:
select_feature3 = X_train.columns
model_rf= RandomForestClassifier(bootstrap=False, ccp_alpha=0.0, class_weight='balanced',
                       criterion='entropy', max_depth=20, max_features='sqrt',
                       max_leaf_nodes=None, max_samples=None,
                       min_impurity_decrease=0.0, min_impurity_split=None,
                       min_samples_leaf=1, min_samples_split=2,
                       min_weight_fraction_leaf=0.0, n_estimators=64,
                       n_jobs=None, oob_score=False, random_state=None,
                       verbose=0, warm_start=False)

model_results('Model 5: RandomForestClassifier Model',logreg=model_rf,select_feature=select_feature3,X_train=X_train_oversampled, y_train=y_train_oversampled, X_val=X_val, y_val=y_val,display_OLS='N')
######################### Model 5: RandomForestClassifier Model #########################
Training Accuracy = 1.0000
Validation Accuracy = 0.9568

Training ROC_AUC_score : 1.0000
Validation ROC_AUC_score : 0.7482

Training f1_score : 1.000000
Validation f1_score : 0.442105
--------------- confusion_matrix ---------------
[[1154   34]
 [  19   21]]



--------------- CLASSIFICATION REPORT ---------------
              precision    recall  f1-score   support

           0     0.9838    0.9714    0.9776      1188
           1     0.3818    0.5250    0.4421        40

    accuracy                         0.9568      1228
   macro avg     0.6828    0.7482    0.7098      1228
weighted avg     0.9642    0.9568    0.9601      1228


Using a threshold of 0.0156 guarantees a sensitivity of 0.9750 and a specificity of 0.6212, i.e. a false positive rate of 37.8788%.







In [123]:
features = X_train.columns
importances = model_rf.feature_importances_
indices = np.argsort(importances)

# customized number 
num_features = 10

plt.figure(figsize=(20,10))
plt.title('Feature Importances')

# only plot the customized number of features
plt.barh(range(num_features), importances[indices[-num_features:]], color='lightskyblue', align='center')
plt.yticks(range(num_features), [features[i] for i in indices[-num_features:]])
plt.xlabel('Relative Importance')
plt.show()
Out[123]:
<Figure size 1440x720 with 0 Axes>
Out[123]:
Text(0.5, 1.0, 'Feature Importances')
Out[123]:
<BarContainer object of 10 artists>
Out[123]:
([<matplotlib.axis.YTick at 0x7fb985784490>,
  <matplotlib.axis.YTick at 0x7fb985783cd0>,
  <matplotlib.axis.YTick at 0x7fb989f518d0>,
  <matplotlib.axis.YTick at 0x7fb985736ed0>,
  <matplotlib.axis.YTick at 0x7fb985744490>,
  <matplotlib.axis.YTick at 0x7fb9857449d0>,
  <matplotlib.axis.YTick at 0x7fb985744890>,
  <matplotlib.axis.YTick at 0x7fb98574c4d0>,
  <matplotlib.axis.YTick at 0x7fb98574ca10>,
  <matplotlib.axis.YTick at 0x7fb98574c8d0>],
 [Text(0, 0, " Net Income to Stockholder's Equity"),
  Text(0, 0, ' Total debt/Total net worth'),
  Text(0, 0, ' Per Share Net profit before tax (Yuan ¥)'),
  Text(0, 0, ' After-tax net Interest Rate'),
  Text(0, 0, ' Net Income to Total Assets'),
  Text(0, 0, ' Persistent EPS in the Last Four Seasons'),
  Text(0, 0, ' Net profit before tax/Paid-in capital'),
  Text(0, 0, ' Continuous interest rate (after tax)'),
  Text(0, 0, ' Retained Earnings to Total Assets'),
  Text(0, 0, ' Borrowing dependency')])
Out[123]:
Text(0.5, 0, 'Relative Importance')
In [104]:
model_xgb = xgb.XGBClassifier(objective = 'binary:logistic')
param_dist = {'n_estimators': stats.randint(150, 1000),
              'learning_rate': stats.uniform(0.01, 0.59),
              'subsample': stats.uniform(0.3, 0.6),
              'max_depth': [3, 4, 5, 6, 7, 8, 9],
              'colsample_bytree': stats.uniform(0.5, 0.4),
              'min_child_weight': [1, 2, 3, 4]
             }

rand_xgb = RandomizedSearchCV(model_xgb, 
                         param_distributions = param_dist,
                         cv =10,  
                         n_iter = 5, 
                         error_score = 0, 
                         verbose = 3, 
                         n_jobs = -1,scoring='f1')

rand_xgb.fit(X_train_oversampled, y_train_oversampled)

print(" Results from Random Search " )
print("\n The best estimator across ALL searched params:\n", rand_xgb.best_estimator_)
print("\n The best score across ALL searched params:\n", rand_xgb.best_score_)
print("\n The best parameters across ALL searched params:\n", rand_xgb.best_params_)
Fitting 10 folds for each of 5 candidates, totalling 50 fits
[Parallel(n_jobs=-1)]: Using backend LokyBackend with 2 concurrent workers.
[Parallel(n_jobs=-1)]: Done  28 tasks      | elapsed:  6.1min
[Parallel(n_jobs=-1)]: Done  50 out of  50 | elapsed: 13.1min finished
Out[104]:
RandomizedSearchCV(cv=10, error_score=0,
                   estimator=XGBClassifier(base_score=0.5, booster='gbtree',
                                           colsample_bylevel=1,
                                           colsample_bynode=1,
                                           colsample_bytree=1, gamma=0,
                                           learning_rate=0.1, max_delta_step=0,
                                           max_depth=3, min_child_weight=1,
                                           missing=None, n_estimators=100,
                                           n_jobs=1, nthread=None,
                                           objective='binary:logistic',
                                           random_state=0, reg_alpha=0,
                                           reg_lambda=1, sca...
                                        'learning_rate': <scipy.stats._distn_infrastructure.rv_frozen object at 0x7fb98a0db590>,
                                        'max_depth': [3, 4, 5, 6, 7, 8, 9],
                                        'min_child_weight': [1, 2, 3, 4],
                                        'n_estimators': <scipy.stats._distn_infrastructure.rv_frozen object at 0x7fb98a05e610>,
                                        'subsample': <scipy.stats._distn_infrastructure.rv_frozen object at 0x7fb98a05e0d0>},
                   pre_dispatch='2*n_jobs', random_state=None, refit=True,
                   return_train_score=False, scoring='f1', verbose=3)
 Results from Random Search 

 The best estimator across ALL searched params:
 XGBClassifier(base_score=0.5, booster='gbtree', colsample_bylevel=1,
              colsample_bynode=1, colsample_bytree=0.8796922826172242, gamma=0,
              learning_rate=0.21044046988031048, max_delta_step=0, max_depth=7,
              min_child_weight=4, missing=None, n_estimators=643, n_jobs=1,
              nthread=None, objective='binary:logistic', random_state=0,
              reg_alpha=0, reg_lambda=1, scale_pos_weight=1, seed=None,
              silent=None, subsample=0.6424182378732652, verbosity=1)

 The best score across ALL searched params:
 0.9884446985586639

 The best parameters across ALL searched params:
 {'colsample_bytree': 0.8796922826172242, 'learning_rate': 0.21044046988031048, 'max_depth': 7, 'min_child_weight': 4, 'n_estimators': 643, 'subsample': 0.6424182378732652}

Figure 15: Gradient Boosted Trees

In [105]:
model_xgb= xgb.XGBClassifier(base_score=0.5, booster='gbtree', colsample_bylevel=1,
              colsample_bynode=1, colsample_bytree=0.8796922826172242, gamma=0,
              learning_rate=0.21044046988031048, max_delta_step=0, max_depth=7,
              min_child_weight=4, missing=None, n_estimators=643, n_jobs=1,
              nthread=None, objective='binary:logistic', random_state=0,
              reg_alpha=0, reg_lambda=1, scale_pos_weight=1, seed=None,
              silent=None, subsample=0.6424182378732652, verbosity=1)

model_results('Model 6: XGBClassifier Model',logreg=model_xgb,select_feature=select_feature3,X_train=X_train_oversampled, y_train=y_train_oversampled, X_val=X_val, y_val=y_val,display_OLS='N')
######################### Model 6: XGBClassifier Model #########################
Training Accuracy = 1.0000
Validation Accuracy = 0.9552

Training ROC_AUC_score : 1.0000
Validation ROC_AUC_score : 0.7353

Training f1_score : 1.000000
Validation f1_score : 0.421053
--------------- confusion_matrix ---------------
[[1153   35]
 [  20   20]]



--------------- CLASSIFICATION REPORT ---------------
              precision    recall  f1-score   support

           0     0.9829    0.9705    0.9767      1188
           1     0.3636    0.5000    0.4211        40

    accuracy                         0.9552      1228
   macro avg     0.6733    0.7353    0.6989      1228
weighted avg     0.9628    0.9552    0.9586      1228


Using a threshold of 0.0001 guarantees a sensitivity of 0.9750 and a specificity of 0.6355, i.e. a false positive rate of 36.4478%.







In [118]:
param_dist = {'max_features' : ['sqrt','log2',0.5,0.6,0.7,0.8,0.9,1.0],  
              'min_samples_leaf' : [1, 2, 3, 7, 10, 11, 100],  
              'max_depth': [10,11,12,13,14],
              'n_estimators': [50, 100,500],  
              'oob_score': [True, False]}  

#rand_extratress = RandomizedSearchCV(ExtraTreesRegressor(warm_start=True,bootstrap=True,random_state=7),  param_distributions = param_dist,  cv=3,  n_iter = 15,random_state=7)  
rand_extratress=RandomizedSearchCV(ExtraTreesClassifier(), param_dist, cv=10, scoring='f1')
rand_extratress.fit(X_train_oversampled, y_train_oversampled)

print(" Results from Random Search " )
print("\n The best estimator across ALL searched params:\n", rand_extratress.best_estimator_)
print("\n The best score across ALL searched params:\n", rand_extratress.best_score_)
print("\n The best parameters across ALL searched params:\n", rand_extratress.best_params_)
Out[118]:
RandomizedSearchCV(cv=10, error_score=nan,
                   estimator=ExtraTreesClassifier(bootstrap=False,
                                                  ccp_alpha=0.0,
                                                  class_weight=None,
                                                  criterion='gini',
                                                  max_depth=None,
                                                  max_features='auto',
                                                  max_leaf_nodes=None,
                                                  max_samples=None,
                                                  min_impurity_decrease=0.0,
                                                  min_impurity_split=None,
                                                  min_samples_leaf=1,
                                                  min_samples_split=2,
                                                  min_weight_fraction_leaf=0.0,
                                                  n_estimators=100, n_jobs...
                                                  warm_start=False),
                   iid='deprecated', n_iter=10, n_jobs=None,
                   param_distributions={'max_depth': [10, 11, 12, 13, 14],
                                        'max_features': ['sqrt', 'log2', 0.5,
                                                         0.6, 0.7, 0.8, 0.9,
                                                         1.0],
                                        'min_samples_leaf': [1, 2, 3, 7, 10, 11,
                                                             100],
                                        'n_estimators': [50, 100, 500],
                                        'oob_score': [True, False]},
                   pre_dispatch='2*n_jobs', random_state=None, refit=True,
                   return_train_score=False, scoring='f1', verbose=0)
 Results from Random Search 

 The best estimator across ALL searched params:
 ExtraTreesClassifier(bootstrap=False, ccp_alpha=0.0, class_weight=None,
                     criterion='gini', max_depth=11, max_features=0.7,
                     max_leaf_nodes=None, max_samples=None,
                     min_impurity_decrease=0.0, min_impurity_split=None,
                     min_samples_leaf=11, min_samples_split=2,
                     min_weight_fraction_leaf=0.0, n_estimators=500,
                     n_jobs=None, oob_score=False, random_state=None, verbose=0,
                     warm_start=False)

 The best score across ALL searched params:
 0.9638799259051269

 The best parameters across ALL searched params:
 {'oob_score': False, 'n_estimators': 500, 'min_samples_leaf': 11, 'max_features': 0.7, 'max_depth': 11}

Figure 16: Extra Trees

In [122]:
model_extraTrees=ExtraTreesClassifier(bootstrap=False, ccp_alpha=0.0, class_weight=None,
                     criterion='gini', max_depth=11, max_features=0.7,
                     max_leaf_nodes=None, max_samples=None,
                     min_impurity_decrease=0.0, min_impurity_split=None,
                     min_samples_leaf=11, min_samples_split=2,
                     min_weight_fraction_leaf=0.0, n_estimators=500,
                     n_jobs=None, oob_score=False, random_state=None, verbose=0,
                     warm_start=False)

model_results('Model 7: ExtraTreesRegressor Model',logreg=model_extraTrees,select_feature=select_feature3,X_train=X_train_oversampled, y_train=y_train_oversampled, X_val=X_val, y_val=y_val,display_OLS='N')
######################### Model 7: ExtraTreesRegressor Model #########################
Training Accuracy = 0.9764
Validation Accuracy = 0.9243

Training ROC_AUC_score : 1.0000
Validation ROC_AUC_score : 0.8280

Training f1_score : 1.000000
Validation f1_score : 0.384106
--------------- confusion_matrix ---------------
[[1106   82]
 [  11   29]]



--------------- CLASSIFICATION REPORT ---------------
              precision    recall  f1-score   support

           0     0.9902    0.9310    0.9597      1188
           1     0.2613    0.7250    0.3841        40

    accuracy                         0.9243      1228
   macro avg     0.6257    0.8280    0.6719      1228
weighted avg     0.9664    0.9243    0.9409      1228


Using a threshold of 0.0485 guarantees a sensitivity of 0.9750 and a specificity of 0.6742, i.e. a false positive rate of 32.5758%.